diff options
author | Karel Zak | 2014-10-17 08:52:00 +0200 |
---|---|---|
committer | Karel Zak | 2014-10-17 08:53:54 +0200 |
commit | ba986e815c36d733724ce5fa9914a2c9ac4f7432 (patch) | |
tree | c19fb9fb7110d8a573cdc087522a0072c85a80b4 /sys-utils/mount.c | |
parent | libfdisk: add more comments (diff) | |
download | kernel-qcow2-util-linux-ba986e815c36d733724ce5fa9914a2c9ac4f7432.tar.gz kernel-qcow2-util-linux-ba986e815c36d733724ce5fa9914a2c9ac4f7432.tar.xz kernel-qcow2-util-linux-ba986e815c36d733724ce5fa9914a2c9ac4f7432.zip |
mount: don't ignore mtab for --bind -o remount
Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/mount.c')
-rw-r--r-- | sys-utils/mount.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c index f7084a963..14a5e5c79 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -697,6 +697,16 @@ static void append_option(struct libmnt_context *cxt, const char *opt) err(MOUNT_EX_SYSERR, _("failed to append option '%s'"), opt); } +static int has_remount_flag(struct libmnt_context *cxt) +{ + unsigned long mflags = 0; + + if (mnt_context_get_mflags(cxt, &mflags)) + return 0; + + return mflags & MS_REMOUNT; +} + static void __attribute__((__noreturn__)) usage(FILE *out) { fputs(USAGE_HEADER, out); @@ -1090,8 +1100,8 @@ int main(int argc, char **argv) /* BIND/MOVE operations, let's set the mount flags */ mnt_context_set_mflags(cxt, oper); - if (oper || propa) - /* For --make-* or --bind is fstab unnecessary */ + if ((oper && !has_remount_flag(cxt)) || propa) + /* For --make-* or --bind is fstab/mtab unnecessary */ mnt_context_set_optsmode(cxt, MNT_OMODE_NOTAB); rc = mnt_context_mount(cxt); |