]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: improve remount logic
authorKarel Zak <kzak@redhat.com>
Mon, 16 Feb 2015 12:38:07 +0000 (13:38 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Feb 2015 12:39:33 +0000 (13:39 +0100)
 * fix fs type detection for remount
 * parse mtab only for remount and umount

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context.c
libmount/src/context_mount.c

index 0fb9f6f8045e916e8828788c87efbf49184249fc..d9391dd6bf6effa9be5cadd1c60f706e73d15193 100644 (file)
@@ -1699,6 +1699,8 @@ int mnt_context_guess_fstype(struct libmnt_context *cxt)
        assert(cxt->fs);
        assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
 
+       DBG(CXT, ul_debugobj(cxt, "preparing fstype"));
+
        if (!cxt || !cxt->fs)
                return -EINVAL;
 
@@ -1714,7 +1716,7 @@ int mnt_context_guess_fstype(struct libmnt_context *cxt)
 
        if (type)
                goto done;
-       if (cxt->flags & MS_REMOUNT)
+       if (cxt->mountflags & MS_REMOUNT)
                goto none;
        if (cxt->fstype_pattern)
                goto done;
@@ -2100,7 +2102,8 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
        }
 
        /* try mtab */
-       if (rc < 0 && (cxt->optsmode & MNT_OMODE_MTAB)) {
+       if (rc < 0 && (cxt->optsmode & MNT_OMODE_MTAB)
+           && (isremount || cxt->action == MNT_ACT_UMOUNT)) {
                DBG(CXT, ul_debugobj(cxt, "trying to apply mtab (src=%s, target=%s)", src, tgt));
                if (tgt)
                        rc = mnt_context_get_mtab_for_target(cxt, &tab, tgt);
index 455ef2ef0d948ab2e8ab61dd1d2ef8a11d88b77d..210f0f16901f1157788b59b499b4f5ca79282258 100644 (file)
@@ -830,7 +830,6 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
        /*
         * Apply pattern to /etc/filesystems and /proc/filesystems
         */
-
        rc = mnt_get_filesystems(&filesystems, neg ? pattern : NULL);
        if (rc)
                return rc;