[PATCH] mount: When a remount to rw fails, quit and return an error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 71ae40744d9fd760bab434e0d5b883501473d513
Author: Valerie Aurora (Henson) <vaurora@xxxxxxxxxx>
Date:   Sun Jul 12 20:28:07 2009 -0700

    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) <vaurora@xxxxxxxxxx>

diff --git a/mount/mount.c b/mount/mount.c
index 10df69e..72b2b95 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1520,6 +1520,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;
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux