From: Karel Zak Date: Wed, 3 Jun 2015 08:59:35 +0000 (+0200) Subject: libmount: do not call umount helper on --fake X-Git-Tag: v2.27-rc1~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28cdf9c61206034b733bf5dcbdea179b8238271f;p=thirdparty%2Futil-linux.git libmount: do not call umount helper on --fake The umount. 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 --- diff --git a/libmount/src/context.c b/libmount/src/context.c index 8d19dc2895..ec04191fcc 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 2a39a6f46d..134c92b6e6 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 887d0ee022..8236ecddb0 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