]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: disable mtab only on statfs() success only
authorKarel Zak <kzak@redhat.com>
Wed, 1 Dec 2021 11:35:42 +0000 (12:35 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Dec 2021 11:44:19 +0000 (12:44 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_umount.c

index 173637a15ad20dbcd0d1eb02bc332fd80befb7ab..25a409e2272caec7eb0c8b1608cb6f7d3e6d8b01 100644 (file)
@@ -283,10 +283,6 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
                return 1; /* not found */
 
        type = mnt_fs_get_fstype(cxt->fs);
-
-       DBG(CXT, ul_debugobj(cxt, "  umount: disabling mtab"));
-       mnt_context_disable_mtab(cxt, TRUE);
-
        if (!type) {
                struct statfs vfs;
                int fd;
@@ -307,6 +303,9 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
                }
        }
        if (type) {
+               DBG(CXT, ul_debugobj(cxt, "  umount: disabling mtab"));
+               mnt_context_disable_mtab(cxt, TRUE);
+
                DBG(CXT, ul_debugobj(cxt,
                        "  mountinfo unnecessary [type=%s]", type));
                return 0;