util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] libmount/tab: always trust the source of a pseudofs
@ 2011-12-26 22:10 Dave Reisner
  2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dave Reisner @ 2011-12-26 22:10 UTC (permalink / raw)
  To: util-linux; +Cc: Dave Reisner

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-01-02 14:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-26 22:10 [PATCH 1/2] libmount/tab: always trust the source of a pseudofs Dave Reisner
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

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).