]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: ignore "bind" from fstab on command line "remount"
authorKarel Zak <kzak@redhat.com>
Tue, 20 Jun 2017 10:46:02 +0000 (12:46 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Jun 2017 10:46:02 +0000 (12:46 +0200)
commit9b76b0e98b7f9e8a7ea1c2b89cf9a73b89fd6bcb
tree31723bd29fb5946a5b47d2f93df1499b33cbb5a9
parent22eb2f0190d8a9850da750641439ccd284ac0bfe
libmount: ignore "bind" from fstab on command line "remount"

The current code always apply all flags from /etc/fstab on remount.
Unfortunately remount+bind has special semantic and it's impossible
from command line to avoid interaction with the "bind" from fstab.

Example, fstab:

/dev/sda1 /bar ext4 defaults 0 1
/bar /foo none bind 0 0

Command line:

    # mount /foo -o remount,rw

produces:

    mount(... MS_REMOUNT|MS_BIND ) syscall

This changes the per-mountpoint (VFS) ro flag to rw, but doesn't
change the filesystem itself.

This patch forces libmount to ignore "bind" from fstab when "-o
remount" specified on command line. If you need remount+bind semantic
you have to specify the "bind" flag on command line. This allow to
differentiate between

    # mount /foo -o remount,bind,rw  --> mount(MS_REMOUNT|MS_BIND)
and

    # mount /foo -o remount,rw       --> mount(MS_REMOUNT)

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context.c
sys-utils/mount.8