summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-02-24 12:17:17 +1100
committerNeilBrown <neilb@suse.de>2010-02-24 12:17:17 +1100
commit24af7a8744d947b5c3f062af55312c044ca12a95 (patch)
tree229c3e395f7dc02bd809c4ad9c449fdfa82fc576
parentad90adb689e3581432d71d995c9a8f0f6d31beb7 (diff)
downloadmdadm-24af7a8744d947b5c3f062af55312c044ca12a95.tar.gz
mdadm-24af7a8744d947b5c3f062af55312c044ca12a95.tar.xz
mdadm-24af7a8744d947b5c3f062af55312c044ca12a95.zip
Assemble: clean up properly if we cannot add the bitmap file.
If we find we cannot add the requested bitmap file when assembling the array, then make sure to clean up properly and don't leave a half-configured array. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Assemble.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index 23cc438..1f73a5b 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1057,12 +1057,14 @@ int Assemble(struct supertype *st, char *mddev,
if (rv) {
fprintf(stderr, Name ": failed to set array info for %s: %s\n",
mddev, strerror(errno));
+ ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
return 1;
}
if (ident->bitmap_fd >= 0) {
if (ioctl(mdfd, SET_BITMAP_FILE, ident->bitmap_fd) != 0) {
fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
+ ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
return 1;
}
@@ -1072,12 +1074,14 @@ int Assemble(struct supertype *st, char *mddev,
if (bmfd < 0) {
fprintf(stderr, Name ": Could not open bitmap file %s\n",
ident->bitmap_file);
+ ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
return 1;
}
if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
close(bmfd);
+ ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
return 1;
}