]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Create.c
imsm: robustify recovery-start detection
[thirdparty/mdadm.git] / Create.c
index 7714828634dc0c0f81de98b8c57e55d085da73e2..b04388f5e338205c3136e7ef6ec9a14ea7063a8a 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -393,9 +393,9 @@ int Create(struct supertype *st, char *mddev,
                                warn |= 1024;
                                fprintf(stderr, Name ": Note: this array has metadata at the start and\n"
                                        "    may not be suitable as a boot device.  If you plan to\n"
-                                       "    store '/' or '/boot' on this device please ensure that\n"
+                                       "    store '/boot' on this device please ensure that\n"
                                        "    your boot-loader understands md/v1.x metadata, or use\n"
-                                       "    --metadata=1.0\n");
+                                       "    --metadata=0.90\n");
                        }
                        close(fd);
                }
@@ -651,6 +651,11 @@ int Create(struct supertype *st, char *mddev,
                        fprintf(stderr, Name ": internal bitmaps not supported by this kernel.\n");
                        goto abort;
                }
+               if (!st->ss->add_internal_bitmap) {
+                       fprintf(stderr, Name ": internal bitmaps not supported with %s metadata\n",
+                               st->ss->name);
+                       goto abort;
+               }
                if (!st->ss->add_internal_bitmap(st, &bitmap_chunk,
                                                 delay, write_behind,
                                                 bitmapsize, 1, major_num)) {
@@ -784,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;
 
@@ -889,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;
                        }
                }
@@ -910,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;