]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: do not call umount helper on --fake
authorKarel Zak <kzak@redhat.com>
Wed, 3 Jun 2015 08:59:35 +0000 (10:59 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Jun 2015 09:02:25 +0000 (11:02 +0200)
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>
libmount/src/context.c
libmount/src/context_umount.c
sys-utils/umount.8

index 8d19dc289565c2653d88a9beb5dc8b030b87a905..ec04191fccb20f56f36b382ebe4ef0d525a9da46 100644 (file)
@@ -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;
index 2a39a6f46d662e647cc0edb85653dc483eb1f568..134c92b6e6ece4502a41c881722dda2a6e71df86 100644 (file)
@@ -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()) {
index 887d0ee0226b024d203b9839f2468ab25a1986e2..8236ecddb057ec25ac21f75efced21e20ffced4c 100644 (file)
@@ -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