[PATCH 1/2] libmount/tab: always trust the source of a pseudofs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux