]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Set readonly state in Grow_continue() when necessary
authorAdam Kwolek <adam.kwolek@intel.com>
Mon, 28 Feb 2011 15:07:19 +0000 (16:07 +0100)
committerNeilBrown <neilb@suse.de>
Wed, 2 Mar 2011 00:36:46 +0000 (11:36 +1100)
When assembling array using assemble_container_content() for external
metadata case, array is in 'readonly' state already.
There is not necessary to duplicate this operation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index cb52cc5a7000d7775ed06436333330541f6ca502..e321a391d4754d1e9e699f728085c758d2413ff4 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3325,11 +3325,13 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
 {
        char buf[40];
        char *container = NULL;
-       int err = sysfs_set_str(info, NULL, "array_state", "readonly");
-       if (err)
-               return err;
+       int err;
 
-       if (st->ss->external) {
+       if (!st->ss->external) {
+               err = sysfs_set_str(info, NULL, "array_state", "readonly");
+               if (err)
+                       return err;
+       } else {
                fmt_devname(buf, st->container_dev);
                container = buf;
        }