summaryrefslogtreecommitdiffstats
path: root/sys-utils/mount.c
diff options
context:
space:
mode:
authorKarel Zak2015-03-20 12:42:33 +0100
committerKarel Zak2015-03-20 12:42:33 +0100
commit8b5b94685b7f91c61ff1abeaa8e7089226d2bf35 (patch)
tree468307fb92480549b49bd31f287f27fa1cb2b4d3 /sys-utils/mount.c
parenttests: remove private2 dir from mount/move (diff)
downloadkernel-qcow2-util-linux-8b5b94685b7f91c61ff1abeaa8e7089226d2bf35.tar.gz
kernel-qcow2-util-linux-8b5b94685b7f91c61ff1abeaa8e7089226d2bf35.tar.xz
kernel-qcow2-util-linux-8b5b94685b7f91c61ff1abeaa8e7089226d2bf35.zip
mount: don't remount read-only on --bind
mount(8) tries to mount read-only when the previous attempt ends with EROFS or EACCES. This is bad idea for bind mounts as "ro,bind" has a special semantic. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/mount.c')
-rw-r--r--sys-utils/mount.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index 141098548..c650efef2 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -611,6 +611,9 @@ try_readonly:
else if (mflags & MS_REMOUNT)
warnx(_("cannot remount %s read-write, is write-protected"), src);
+ else if (mflags & MS_BIND)
+ warn(_("mount %s on %s failed"), src, tgt);
+
else {
warnx(_("%s is write-protected, mounting read-only"), src);