From: Dave Reisner Date: Mon, 26 Dec 2011 22:10:22 +0000 (-0500) Subject: libmount: always trust the source of a pseudofs X-Git-Tag: v2.21-rc1~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14f66ad69a02ce5c39a92f1b27384f63507934a4;p=thirdparty%2Futil-linux.git libmount: always trust the source of a pseudofs 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) [kzak@redhat.com: - use fs->flags to detect pseudo FS] Signed-off-by: Dave Reisner Signed-off-by: Karel Zak --- diff --git a/libmount/src/tab.c b/libmount/src/tab.c index 2bc49e3b7a..8b708112d5 100644 --- a/libmount/src/tab.c +++ b/libmount/src/tab.c @@ -841,6 +841,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 (fstab_fs->flags & MNT_FS_PSEUDO) + src = mnt_fs_get_source(fstab_fs); else src = mnt_resolve_spec(mnt_fs_get_source(fstab_fs), tb->cache);