]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: clean up properly if we cannot add the bitmap file.
authorNeilBrown <neilb@suse.de>
Wed, 24 Feb 2010 01:17:17 +0000 (12:17 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 24 Feb 2010 01:17:17 +0000 (12:17 +1100)
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>
Assemble.c

index 23cc438de596a68437e476d1e0b9b51625e9794d..1f73a5be05f5339ee6811860f269e0556bc684d5 100644 (file)
@@ -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;
                        }