util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Reisner <d@falconindy.com>
To: util-linux@vger.kernel.org
Cc: Dave Reisner <dreisner@archlinux.org>
Subject: [PATCH 1/2] libmount/tab: always trust the source of a pseudofs
Date: Mon, 26 Dec 2011 17:10:22 -0500	[thread overview]
Message-ID: <1324937423-15766-1-git-send-email-dreisner@archlinux.org> (raw)

Since nodev FSs have no backing block device, it's unreasonable to try
and resolve the source back to a path on the filesystem. Always trust
the source of the FS given in /etc/fstab to avoid remounting the device
when a directory of the same name exists in the current working
directory.

Example reproduction:

  # mkdir /foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # mount -a
  # cd /root; mkdir foo
  # mount -a
  # mount | grep /foo
  foo on /foo type tmpfs (rw,relatime)
  /root/foo on /foo type tmpfs (rw,relatime)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
 libmount/src/tab.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 2bc49e3..da3677f 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -45,6 +45,7 @@
 
 #include "mountP.h"
 #include "strutils.h"
+#include "utils.h"
 
 /**
  * mnt_new_table:
@@ -841,6 +842,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
 	src_fs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
 	if (src_fs)
 		src = mnt_fs_get_srcpath(src_fs);
+	else if (mnt_fstype_is_pseudofs(mnt_fs_get_fstype(fstab_fs)))
+		src = mnt_fs_get_source(fstab_fs);
 	else
 		src = mnt_resolve_spec(mnt_fs_get_source(fstab_fs), tb->cache);
 
-- 
1.7.8.1


             reply	other threads:[~2011-12-26 22:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 22:10 Dave Reisner [this message]
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
2012-01-02 14:02   ` Karel Zak
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
2011-12-27 11:29   ` Karel Zak
2012-01-02 14:02   ` Karel Zak
2012-01-02 14:01 ` [PATCH 1/2] libmount/tab: always trust " Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324937423-15766-1-git-send-email-dreisner@archlinux.org \
    --to=d@falconindy.com \
    --cc=dreisner@archlinux.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).