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>
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;