summaryrefslogtreecommitdiffstats
path: root/libmount/src/context.c
diff options
context:
space:
mode:
authorKarel Zak2014-12-18 10:30:14 +0100
committerKarel Zak2014-12-18 10:47:39 +0100
commit01966ce852ac6c46e7e35a8e4f981dea88620ff8 (patch)
tree07764c970d4bffbc4180bd43964a882f27e05d46 /libmount/src/context.c
parentlogin-utils: Enable building util-linux against OpenPAM (diff)
downloadkernel-qcow2-util-linux-01966ce852ac6c46e7e35a8e4f981dea88620ff8.tar.gz
kernel-qcow2-util-linux-01966ce852ac6c46e7e35a8e4f981dea88620ff8.tar.xz
kernel-qcow2-util-linux-01966ce852ac6c46e7e35a8e4f981dea88620ff8.zip
libmount: allow unspecified source on remount
kernel does not require mount source (e.g. device name) on remount, it means that fstab/mtab/mountinfo should be optional in this case. For example: mount -o rw,remount / has to work on system without mounted /proc. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context.c')
-rw-r--r--libmount/src/context.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c
index a320b3e6b..14fa44b52 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -2025,7 +2025,7 @@ static int apply_table(struct libmnt_context *cxt, struct libmnt_table *tb,
*/
int mnt_context_apply_fstab(struct libmnt_context *cxt)
{
- int rc = -1;
+ int rc = -1, isremount = 0;
struct libmnt_table *tab = NULL;
const char *src = NULL, *tgt = NULL;
unsigned long mflags = 0;
@@ -2056,6 +2056,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
DBG(CXT, ul_debugobj(cxt, "force mtab parsing on remount"));
cxt->optsmode |= MNT_OMODE_MTAB;
cxt->optsmode &= ~MNT_OMODE_FSTAB;
+ isremount = 1;
}
if (cxt->fs) {
@@ -2109,6 +2110,13 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
rc = apply_table(cxt, tab, MNT_ITER_BACKWARD);
}
if (rc) {
+ if (!mnt_context_is_restricted(cxt)
+ && tgt && !src
+ && isremount) {
+ DBG(CXT, ul_debugobj(cxt, "only target; ignore missing mtab entry on remount"));
+ return 0;
+ }
+
DBG(CXT, ul_debugobj(cxt, "failed to find entry in fstab/mtab [rc=%d]: %m", rc));
/* force to "not found in fstab/mtab" error, the details why