From: Karel Zak Date: Mon, 16 Feb 2015 12:38:07 +0000 (+0100) Subject: libmount: improve remount logic X-Git-Tag: v2.26~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff5ace78d6a6f8274e12080cc282c41ad58a0c7f;p=thirdparty%2Futil-linux.git libmount: improve remount logic * fix fs type detection for remount * parse mtab only for remount and umount Signed-off-by: Karel Zak --- diff --git a/libmount/src/context.c b/libmount/src/context.c index 0fb9f6f804..d9391dd6bf 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -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); diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 455ef2ef0d..210f0f1690 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -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;