]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
reshape: support raid5 grow on certain older kernels.
authorNeilBrown <neilb@suse.de>
Wed, 25 Mar 2015 23:06:26 +0000 (10:06 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 25 Mar 2015 23:06:26 +0000 (10:06 +1100)
Kernels between
  c6563a8c38fde3c1c7fc925a v3.5-rc1~110^2~53
and
  b5254dd5fdd9abcacadb5101 v3.5-rc1~110^2~51

allow new_offset to be set, but don't then allow a RAID5
to be reshaped to change that offset.
Due to selective backports, this includes the SLES11-SP3 kernel.

It is quite easy to handle this case in mdadm, so we do.
Specifically: if the reshape with data-offset fails with EINVAL,
abort the data-offset change and try the "old" way.

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

diff --git a/Grow.c b/Grow.c
index a8bbf2bf19a5c58610145bff0e0e5e2aafcc6fa3..9a573fd49f5db48a7cd5eabd9492932e3398a50d 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3102,8 +3102,19 @@ static int reshape_array(char *container, int fd, char *devname,
                                   devname, container, &reshape) < 0)
                        goto release;
                if (sysfs_set_str(sra, NULL, "sync_action", "reshape") < 0) {
-                       pr_err("Failed to initiate reshape!\n");
-                       goto release;
+                       struct mdinfo *sd;
+                       if (errno != EINVAL) {
+                               pr_err("Failed to initiate reshape!\n");
+                               goto release;
+                       }
+                       /* revert data_offset and try the old way */
+                       for (sd = sra->devs; sd; sd = sd->next) {
+                               sysfs_set_num(sra, sd, "new_offset",
+                                             sd->data_offset);
+                               sysfs_set_str(sra, NULL, "reshape_direction",
+                                             "forwards");
+                       }
+                       break;
                }
                if (info->new_level == reshape.level)
                        return 0;