summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2015-06-03 10:59:35 +0200
committerKarel Zak2015-06-03 11:02:25 +0200
commit28cdf9c61206034b733bf5dcbdea179b8238271f (patch)
treec11eb1049337e1dcc3084e226e2a2f691a1b11bd
parentlscpu: add warning for __SANITIZE_ADDRESS__ (diff)
downloadkernel-qcow2-util-linux-28cdf9c61206034b733bf5dcbdea179b8238271f.tar.gz
kernel-qcow2-util-linux-28cdf9c61206034b733bf5dcbdea179b8238271f.tar.xz
kernel-qcow2-util-linux-28cdf9c61206034b733bf5dcbdea179b8238271f.zip
libmount: do not call umount helper on --fake
The umount.<type> helpers does not support --fake option and it does not make sense to call the helpers at all. All we need is to remove mtab/utab entries. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172297 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--libmount/src/context.c6
-rw-r--r--libmount/src/context_umount.c6
-rw-r--r--sys-utils/umount.85
3 files changed, 12 insertions, 5 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c
index 8d19dc289..ec04191fc 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -1816,10 +1816,10 @@ int mnt_context_prepare_update(struct libmnt_context *cxt)
target = mnt_fs_get_target(cxt->fs);
- if (cxt->action == MNT_ACT_UMOUNT && target && !strcmp(target, "/"))
- /* Don't try to touch mtab if umounting root FS */
+ if (cxt->action == MNT_ACT_UMOUNT && target && !strcmp(target, "/")) {
+ DBG(CXT, ul_debugobj(cxt, "root umount: setting NOMTAB"));
mnt_context_disable_mtab(cxt, TRUE);
-
+ }
if (mnt_context_is_nomtab(cxt)) {
DBG(CXT, ul_debugobj(cxt, "skip update: NOMTAB flag"));
return 0;
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 2a39a6f46..134c92b6e 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -510,6 +510,12 @@ static int exec_helper(struct libmnt_context *cxt)
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
assert(cxt->helper_exec_status == 1);
+ if (mnt_context_is_fake(cxt)) {
+ DBG(CXT, ul_debugobj(cxt, "fake mode: does not execute helper"));
+ cxt->helper_exec_status = rc = 0;
+ return rc;
+ }
+
DBG_FLUSH;
switch (fork()) {
diff --git a/sys-utils/umount.8 b/sys-utils/umount.8
index 887d0ee02..8236ecddb 100644
--- a/sys-utils/umount.8
+++ b/sys-utils/umount.8
@@ -83,8 +83,9 @@ When the unmounted device was a loop device, also free this loop
device.
.TP
.B \-\-fake
-Causes everything to be done except for the actual system call; this 'fakes'
-unmounting the filesystem. It can be used to remove entries from
+Causes everything to be done except for the actual system call or umount helper
+execution; this 'fakes' unmounting the filesystem. It can be used to remove
+entries from
.I /etc/mtab
that were unmounted earlier with the
.B \-n