summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-12-01 01:03:28 +0100
committerNeilBrown <neilb@suse.de>2010-12-01 01:03:28 +0100
commit4c8214543f5cffefd093722227d2fb1fb81a683e (patch)
tree1cd69664d002a0afc2d4fe4d6d729084cc14396e
parentddf: fail creation of new subarray with same name as old. (diff)
downloadmdadm-4c8214543f5cffefd093722227d2fb1fb81a683e.tar.xz
mdadm-4c8214543f5cffefd093722227d2fb1fb81a683e.zip
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>
-rw-r--r--Create.c15
-rw-r--r--tests/10ddf-create1
2 files changed, 12 insertions, 4 deletions
diff --git a/Create.c b/Create.c
index 4a79fb04..c1364731 100644
--- a/Create.c
+++ b/Create.c
@@ -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;
diff --git a/tests/10ddf-create b/tests/10ddf-create
index d8dca58b..25b13529 100644
--- a/tests/10ddf-create
+++ b/tests/10ddf-create
@@ -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