[PATCH] fix mount -a on btrfs bind mount

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

 



Do not prepend src_root to root for bind mounts on btrfs.

root has to be literally the same as src_root, which is already the path
prefixed by /{subvolume}. Otherwise it will not match in
mnt_fs_streq_target(fs, xtgt) inside mnt_table_is_fs_mounted() and
repeated "mount -a" will mount it again and again.

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

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 0df8d49..eeb9c57 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1247,12 +1247,9 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
 		 */
 		src_root = mnt_fs_get_root(src_fs);
 		if (src_root && !startswith(root, src_root)) {
-			size_t sz = strlen(root) + strlen(src_root) + 1;
-			char *tmp = malloc(sz);
-
+			char *tmp = strdup (src_root);
 			if (!tmp)
 				goto err;
-			snprintf(tmp, sz, "%s%s", src_root, root);
 			free(root);
 			root = tmp;
 		}
-- 
2.6.3

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@xxxxxxxx
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 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