]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Create.c
Create: tell udev md device is not ready when first created.
[thirdparty/mdadm.git] / Create.c
index 6ca0924498809770d6f5898ea6f8c151090a0573..df1bc20c635b53e5c80ae774b9b03bab16b78e38 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -605,7 +605,7 @@ int Create(struct supertype *st, char *mddev,
 
        /* We need to create the device */
        map_lock(&map);
-       mdfd = create_mddev(mddev, name, c->autof, LOCAL, chosen_name);
+       mdfd = create_mddev(mddev, name, c->autof, LOCAL, chosen_name, 1);
        if (mdfd < 0) {
                map_unlock(&map);
                return 1;
@@ -620,6 +620,7 @@ int Create(struct supertype *st, char *mddev,
                        chosen_name);
                close(mdfd);
                map_unlock(&map);
+               udev_unblock();
                return 1;
        }
        mddev = chosen_name;
@@ -1053,9 +1054,15 @@ int Create(struct supertype *st, char *mddev,
                pr_err("not starting array - not enough devices.\n");
        }
        close(mdfd);
+       /* Give udev a moment to process the Change event caused
+        * by the close.
+        */
+       usleep(100*1000);
+       udev_unblock();
        return 0;
 
  abort:
+       udev_unblock();
        map_lock(&map);
  abort_locked:
        map_remove(&map, fd2devnm(mdfd));