Create: report failure if array cannot be started.

We weren't checking the result of writing 'active' to array_state

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2010-12-01 11:03:28 +11:00
parent 97c9c10014
commit 4c8214543f
2 changed files with 12 additions and 4 deletions

View File

@ -872,20 +872,27 @@ int Create(struct supertype *st, char *mddev,
wait_for(chosen_name, mdfd);
} else if (runstop == 1 || subdevs >= raiddisks) {
if (st->ss->external) {
int err;
switch(level) {
case LEVEL_LINEAR:
case LEVEL_MULTIPATH:
case 0:
sysfs_set_str(&info, NULL, "array_state",
"active");
err = sysfs_set_str(&info, NULL, "array_state",
"active");
need_mdmon = 0;
break;
default:
sysfs_set_str(&info, NULL, "array_state",
"readonly");
err = sysfs_set_str(&info, NULL, "array_state",
"readonly");
break;
}
sysfs_set_safemode(&info, safe_mode_delay);
if (err) {
fprintf(stderr, Name ": failed to"
" activate array.\n");
ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
}
} else {
/* param is not actually used */
mdu_param_t param;

View File

@ -7,6 +7,7 @@
#
# add some data, tear down the array, reassemble
# and make sure it is still there.
set -e
mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12
mdadm -CR r0 -l0 -n5 /dev/md/ddf0 -z 5000