]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
sysfs: allow sysfs_read to detect and drop removed disks
[thirdparty/mdadm.git] / super-intel.c
index f55d707667b17baa47b31172eea02a8e8f78ffa6..dd69cb133f03961341d89df0b780baa316b9ba17 100644 (file)
@@ -1976,9 +1976,14 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
        int rv;
        int devnum = fd2devnum(fd);
        int retry;
+       enum sysfs_read_flags flags;
 
-       /* check if this disk is a member of an active array */
-       sra = sysfs_read(fd, 0, GET_LEVEL|GET_VERSION|GET_DEVS|GET_STATE);
+       flags = GET_LEVEL|GET_VERSION|GET_DEVS|GET_STATE;
+       if (mdmon_running(devnum))
+               flags |= SKIP_GONE_DEVS;
+
+       /* check if 'fd' an opened container */
+       sra = sysfs_read(fd, 0, flags);
        if (!sra)
                return 1;