]> err.no Git - util-linux/commitdiff
mount: when a remount to rw fails, quit and return an error
authorValerie Aurora <vaurora@redhat.com>
Tue, 14 Jul 2009 17:21:34 +0000 (13:21 -0400)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jul 2009 18:32:54 +0000 (20:32 +0200)
A nice feature of mount is that when you attempt to mount a file
system read-write, and that fails because it can only be mounted
read-only, it goes ahead and retries the mount with the "ro" option
and returns success if that succeeds.  However, this code path is also
followed when you are doing a remount for the sole purpose of changing
the mount from read-only to read-write - the change fails, but mount
returns success.  Instead, check if we are attempting to remount and
fail out immediately, instead of retrying with the old "ro" option and
whee, happily "succeeding."

Signed-off-by: Valerie Aurora (Henson) <vaurora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/mount.c

index c636e9dc788672a36f30658f7cfeb29ef06f104d..ef478c79322480acc0a620d9c7a84be593eb9bee 100644 (file)
@@ -1523,6 +1523,10 @@ mount_retry:
          error (_("mount: %s%s is write-protected but explicit `-w' flag given"),
                 bd, spec);
          break;
+      } else if (flags & MS_REMOUNT) {
+         error (_("mount: cannot remount %s%s read-write, is write-protected"),
+                bd, spec);
+         break;
       } else {
         opts = opts0;
         types = types0;