]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Monitor.c
Monitor: fix for regression with container devices
[thirdparty/mdadm.git] / Monitor.c
index 971d2ecbea723a8d6afbf77339b6e3ed9f92c803..66d67baf5c987e107df52e7ad4cdd8e874755d29 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -483,11 +483,17 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
                    strncmp(buf,"inact",5) == 0) {
                        if (fd >= 0)
                                close(fd);
-                       if (!st->err)
-                               alert("DeviceDisappeared", dev, NULL, ainfo);
-                       st->err++;
-                       return 0;
+                       fd = sysfs_open(st->devnm, NULL, "level");
+                       if (fd < 0 || read(fd, buf, 10) != 0) {
+                               if (fd >= 0)
+                                       close(fd);
+                               if (!st->err)
+                                       alert("DeviceDisappeared", dev, NULL, ainfo);
+                               st->err++;
+                               return 0;
+                       }
                }
+               close(fd);
        }
        fd = open(dev, O_RDONLY);
        if (fd < 0) {