[PATCH] libmount: Skip root comparison for cifs in mnt_table_is_fs_mounted()

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

 



In mountinfo of cifs filesystem, root is filled with a relative path to the root
of the exported volume. There is no reasonable way to compare it without making
a network look-up.

This causes false negative result in some cases.

Skipping root comparison in mnt_table_is_fs_mounted() makes things better,
however it still does not cover all possible setups.

How to reproduce:
1) Create and export a cifs volume (with guest allowed).
2) Make a subdirectory in this volume.
3) Mount this subdirectory using fstab:
   //server/volume/subdir /mnt cifs guest 0 0
4) Call mount -a twice.
   Depending on a system running, you either get:
     mount error(16): Device or resource busy
     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
   or you get a volume mounted twice.

Signed-off-by: Stanislav Brabec <sbrabec@xxxxxxx>
---
 libmount/src/tab.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 155c65e..aa9185a 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1562,7 +1562,10 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
 #endif
 		}
 
-		if (root) {
+		/* For cifs, root contains a relative path to the exported volume,
+		 * i. e. something we cannot compare.
+		 */
+		if (root && strcmp(mnt_fs_get_fstype(fs), "cifs")) {
 			const char *r = mnt_fs_get_root(fs);
 			if (!r || strcmp(r, root) != 0)
 				continue;
-- 
2.9.2

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@xxxxxxxx
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
--
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