[PATCH] umount(recursive): add a cache to the table

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

 



Without this table libmount will not resolve paths, meaning that
umounting by relative path will fail.

Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx>
---
Alternatively, one could call mnt_resolve_path(spec, NULL) and avoid attaching
the cache for the single lookup.

 sys-utils/umount.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys-utils/umount.c b/sys-utils/umount.c
index b21e396..87812ac 100644
--- a/sys-utils/umount.c
+++ b/sys-utils/umount.c
@@ -364,6 +364,7 @@ done:
 static int umount_recursive(struct libmnt_context *cxt, const char *spec)
 {
 	struct libmnt_table *tb;
+	struct libmnt_cache *cache;
 	int rc;
 
 	/* it's always real mountpoint, don't assume that the target maybe a device */
@@ -374,6 +375,11 @@ static int umount_recursive(struct libmnt_context *cxt, const char *spec)
 		err(MOUNT_EX_SYSERR, _("libmount table allocation failed"));
 	mnt_table_set_parser_errcb(tb, table_parser_errcb);
 
+	cache = mnt_new_cache();
+	if (!cache)
+		err(MOUNT_EX_SYSERR, _("libmount cache allocation failed"));
+	mnt_table_set_cache(tb, cache);
+
 	/*
 	 * Don't use mtab here. The recursive umount depends on child-parent
 	 * relationship defined by mountinfo file.
@@ -395,6 +401,7 @@ static int umount_recursive(struct libmnt_context *cxt, const char *spec)
 		}
 	}
 
+	mnt_free_cache(cache);
 	mnt_free_table(tb);
 	return rc;
 }
-- 
1.8.0

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