]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add test for interaction of --assemble with --incr
authorNeilBrown <neilb@suse.de>
Wed, 19 Jun 2013 06:33:55 +0000 (16:33 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 19 Jun 2013 06:34:47 +0000 (16:34 +1000)
and fix the bug that it found.  The refactor of start_array()
missed a test.

Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c
tests/03assem-incr [new file with mode: 0644]

index 8e3c929f4440158b63a486112c17fa473219fb9f..383b149e739d42a5ae20f8c2d2485ddf80f3548c 100644 (file)
@@ -884,6 +884,7 @@ static int start_array(int mdfd,
                       struct context *c,
                       int clean, char *avail,
                       int start_partial_ok,
+                      int err_ok,
                       int was_forced
        )
 {
@@ -892,7 +893,7 @@ static int start_array(int mdfd,
        unsigned int req_cnt;
 
        rv = set_array_info(mdfd, st, content);
-       if (rv) {
+       if (rv && !err_ok) {
                pr_err("failed to set array info for %s: %s\n",
                       mddev, strerror(errno));
                return 1;
@@ -1706,7 +1707,9 @@ try_again:
                         chosen_drive, devices, okcnt, sparecnt,
                         rebuilding_cnt,
                         c,
-                        clean, avail, start_partial_ok, was_forced);
+                        clean, avail, start_partial_ok,
+                        pre_exist != NULL,
+                        was_forced);
        if (rv == 1 && !pre_exist)
                ioctl(mdfd, STOP_ARRAY, NULL);
        free(devices);
diff --git a/tests/03assem-incr b/tests/03assem-incr
new file mode 100644 (file)
index 0000000..f10a1a4
--- /dev/null
@@ -0,0 +1,17 @@
+set -x -e
+
+# Test interaction between -I and -A
+# there are locking issue too, but those are hard to test for.
+#
+# Here just test that a partly "-I" assembled array can
+# be completed with "-A"
+
+for l in 0 1 5 linear
+do
+  mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean
+  mdadm -S md0
+  mdadm -I $dev1
+  mdadm -I $dev3
+  mdadm -A /dev/md0  $dev0 $dev1 $dev2 $dev3 $dev4
+  mdadm -S /dev/md0
+done