Add test for interaction of --assemble with --incr

and fix the bug that it found.  The refactor of start_array()
missed a test.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2013-06-19 16:33:55 +10:00
parent ccec2685ab
commit 71417de6fe
2 changed files with 22 additions and 2 deletions

View 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);

17
tests/03assem-incr Normal file
View File

@ -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