summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2017-06-07 12:40:17 +0200
committerKarel Zak2017-06-07 12:40:17 +0200
commit11573ac0c840e5189873fcd897a14356942172cf (patch)
tree12453d89fe9a2f40539f797d6039f0bf1bb4c743 /libmount/src/context_umount.c
parentlibmount: use mount table filter on --no-canonicalize (diff)
downloadkernel-qcow2-util-linux-11573ac0c840e5189873fcd897a14356942172cf.tar.gz
kernel-qcow2-util-linux-11573ac0c840e5189873fcd897a14356942172cf.tar.xz
kernel-qcow2-util-linux-11573ac0c840e5189873fcd897a14356942172cf.zip
libmount: (umount) use mount table filter on -c only
The path canonicalization is the worst use-case, it's better to read all mount table than try canonicalize. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 4a4c5bfe5..e0b7bda11 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -78,11 +78,14 @@ int mnt_context_find_umount_fs(struct libmnt_context *cxt,
* canonicalized. If --no-canonicalize is enabled than the target path
* is expected already canonical.
*
+ * Anyway it's better to read huge mount table than canonicalize target
+ * paths. It means we use the filter only if --no-canonicalize enabled.
+ *
* 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_force(cxt) && !mnt_context_is_lazy(cxt))
+ if (mnt_context_is_nocanonicalize(cxt) &&
+ !mnt_context_mtab_writable(cxt) && *tgt == '/')
rc = mnt_context_get_mtab_for_target(cxt, &mtab, tgt);
else
rc = mnt_context_get_mtab(cxt, &mtab);
@@ -257,12 +260,16 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
const char *type = mnt_fs_get_fstype(cxt->fs);
+ DBG(CXT, ul_debugobj(cxt, "umount: disable mtab"));
+
/* !mnt_context_mtab_writable(cxt) && has_utab_entry() verified that there
* is no stuff in utab, so disable all mtab/utab related actions */
mnt_context_disable_mtab(cxt, TRUE);
if (!type) {
struct statfs vfs;
+
+ DBG(CXT, ul_debugobj(cxt, "umount: trying statfs()"));
if (statfs(tgt, &vfs) == 0)
type = mnt_statfs_get_fstype(&vfs);
if (type) {