summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2017-06-07 11:35:26 +0200
committerKarel Zak2017-06-07 11:35:26 +0200
commitf8416301c195d50a21cb54d9ea9abeccc40f9ee7 (patch)
tree9c55ab36703691d74d0b674f99631d2001e59acc /libmount/src/context_umount.c
parentrename: add -o to the man page (diff)
downloadkernel-qcow2-util-linux-f8416301c195d50a21cb54d9ea9abeccc40f9ee7.tar.gz
kernel-qcow2-util-linux-f8416301c195d50a21cb54d9ea9abeccc40f9ee7.tar.xz
kernel-qcow2-util-linux-f8416301c195d50a21cb54d9ea9abeccc40f9ee7.zip
libmount: use mount table filter on --no-canonicalize
The umount command option --no-canonicalize means that the path is already canonical. So, we can use mount table filter in this case too. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 693891def..4a4c5bfe5 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -67,17 +67,21 @@ int mnt_context_find_umount_fs(struct libmnt_context *cxt,
return 1; /* empty string is not an error */
/*
- * The mount table may be huge, and on systems with utab we have to merge
- * userspace mount options into /proc/self/mountinfo. This all is
- * expensive. The tab filter allows to filter out entries, then
- * a mount table and utab are very tiny files.
+ * The mount table may be huge, and on systems with utab we have to
+ * merge userspace mount options into /proc/self/mountinfo. This all is
+ * expensive. The tab filter allows to filter out entries, then a mount
+ * table and utab are very tiny files.
*
- * *but*... the filter uses mnt_fs_streq_{target,srcpath} functions
- * where LABEL, UUID or symlinks are canonicalized. It means that
- * it's usable only for canonicalized stuff (e.g. kernel mountinfo).
+ * The filter uses mnt_fs_streq_{target,srcpath} function where all
+ * paths should be absolute and canonicalized. This is done within
+ * mnt_context_get_mtab_for_target() where LABEL, UUID or symlinks are
+ * canonicalized. If --no-canonicalize is enabled than the target path
+ * is expected already canonical.
+ *
+ * It also means that we have to read mount table from kernel
+ * (non-writable mtab).
*/
if (!mnt_context_mtab_writable(cxt) && *tgt == '/' &&
- !mnt_context_is_nocanonicalize(cxt) &&
!mnt_context_is_force(cxt) && !mnt_context_is_lazy(cxt))
rc = mnt_context_get_mtab_for_target(cxt, &mtab, tgt);
else