summaryrefslogtreecommitdiffstats
path: root/Create.c
diff options
context:
space:
mode:
Diffstat (limited to 'Create.c')
-rw-r--r--Create.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Create.c b/Create.c
index 8f6e6e7..b04388f 100644
--- a/Create.c
+++ b/Create.c
@@ -789,8 +789,10 @@ int Create(struct supertype *st, char *mddev,
if (fd >= 0)
remove_partitions(fd);
if (st->ss->add_to_super(st, &inf->disk,
- fd, dv->devname))
+ fd, dv->devname)) {
+ ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
+ }
st->ss->getinfo_super(st, inf);
safe_mode_delay = inf->safe_mode_delay;
@@ -894,7 +896,7 @@ int Create(struct supertype *st, char *mddev,
if (ioctl(mdfd, RUN_ARRAY, &param)) {
fprintf(stderr, Name ": RUN_ARRAY failed: %s\n",
strerror(errno));
- Manage_runstop(mddev, mdfd, -1, 0);
+ ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
}
}
@@ -915,6 +917,10 @@ int Create(struct supertype *st, char *mddev,
return 0;
abort:
+ map_lock(&map);
+ map_remove(&map, fd2devnum(mdfd));
+ map_unlock(&map);
+
if (mdfd >= 0)
close(mdfd);
return 1;