]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Incremental.c
Incremental: restore assembly for inactive containers, block active
[thirdparty/mdadm.git] / Incremental.c
index 96bfcec7fc586f38a1cec96c746cb188981b0bc7..abfea243c1f9143bc1eb6accf36035ae342669eb 100644 (file)
@@ -376,7 +376,16 @@ int Incremental(char *devname, int verbose, int runstop,
                 * statement about this.
                 */
                if (runstop < 1) {
-                       if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0) {
+                       int active = 0;
+                       
+                       if (st->ss->external) {
+                               char *devname = devnum2devname(fd2devnum(mdfd));
+
+                               active = devname && is_container_active(devname);
+                               free(devname);
+                       } else if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0)
+                               active = 1;
+                       if (active) {
                                fprintf(stderr, Name
                                        ": not adding %s to active array (without --run) %s\n",
                                        devname, chosen_name);