From 3bb3fe8cb0233a07919125f5e839cae80fe28a38 Mon Sep 17 00:00:00 2001 From: Valerie Aurora Date: Tue, 14 Jul 2009 13:21:34 -0400 Subject: [PATCH] mount: when a remount to rw fails, quit and return an error 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) Signed-off-by: Karel Zak --- mount/mount.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mount/mount.c b/mount/mount.c index c636e9dc..ef478c79 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -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; -- 2.39.5