]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Assemble.c
Check all member devices in enough_fd
[thirdparty/mdadm.git] / Assemble.c
index bfc879c7f4433550aa25e80dc1fd39156544582f..8b05829d3a132ed72dd7ddc63ae5772276b5fe81 100644 (file)
@@ -1062,6 +1062,8 @@ int Assemble(struct supertype *st, char *mddev,
                        continue;
                if (!devices[j].uptodate)
                        continue;
+               if (devices[j].i.events < devices[most_recent].i.events)
+                       continue;
                chosen_drive = j;
                if ((fd=dev_open(devices[j].devname, O_RDONLY|O_EXCL))< 0) {
                        fprintf(stderr, Name ": Cannot open %s: %s\n",
@@ -1158,6 +1160,9 @@ int Assemble(struct supertype *st, char *mddev,
                        free(devices);
                        return 1;
                }
+               if (verbose >= 0)
+                       fprintf(stderr, Name ": Marking array %s as 'clean'\n",
+                               mddev);
                close(fd);
        }
 
@@ -1511,6 +1516,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
        int working = 0, preexist = 0;
        int expansion = 0;
        struct map_ent *map = NULL;
+       int old_raid_disks;
 
        sysfs_init(content, mdfd, 0);
 
@@ -1524,10 +1530,10 @@ int assemble_container_content(struct supertype *st, int mdfd,
 
        if (sra)
                sysfs_free(sra);
-
+       old_raid_disks = content->array.raid_disks - content->delta_disks;
        for (dev = content->devs; dev; dev = dev->next)
                if (sysfs_add_disk(content, dev, 1) == 0) {
-                       if (dev->disk.raid_disk >= content->array.raid_disks &&
+                       if (dev->disk.raid_disk >= old_raid_disks &&
                            content->reshape_active)
                                expansion++;
                        else
@@ -1598,7 +1604,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
                        if (!err) {
                                if (!mdmon_running(st->container_dev))
                                        start_mdmon(st->container_dev);
-                               ping_monitor(devnum2devname(st->container_dev));
+                               ping_monitor_by_id(st->container_dev);
                        }
                        break;
                }