]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: allow auto-readonly arrays to be reshaped.
authorNeilBrown <neilb@suse.de>
Tue, 10 May 2011 03:09:37 +0000 (13:09 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 10 May 2011 03:09:37 +0000 (13:09 +1000)
In an array is auto-readonly then a reshape will not start.
But auto-readonly is only wanted until something is explicitly
done to acknowledge that the array is really wanted.
So it is perfectly correct to switch an auto-readonly array to
'clean' if a reshape has been requested.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 5840a2c160b0e7a52a7e4edc1e33835e732d8781..1e1e9f8c3161553577a070b13aa48c7990f2ea81 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -521,9 +521,15 @@ static int freeze(struct supertype *st)
        else {
                struct mdinfo *sra = sysfs_read(-1, st->devnum, GET_VERSION);
                int err;
+               char buf[20];
 
                if (!sra)
                        return -1;
+               /* Need to clear any 'read-auto' status */
+               if (sysfs_get_str(sra, NULL, "array_state", buf, 20) > 0 &&
+                   strncmp(buf, "read-auto", 9) == 0)
+                       sysfs_set_str(sra, NULL, "array_state", "clean");
+
                err = sysfs_freeze_array(sra);
                sysfs_free(sra);
                return err;