]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: don't remount read-only on --bind
authorKarel Zak <kzak@redhat.com>
Fri, 20 Mar 2015 11:42:33 +0000 (12:42 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 20 Mar 2015 11:42:33 +0000 (12:42 +0100)
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>
sys-utils/mount.c

index 141098548dc7f687cb9f9d32c5cd53367d6c16d9..c650efef2d5359b973a2fd53fa77d571711e207c 100644 (file)
@@ -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);