summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Paszkiewicz <artur.paszkiewicz@intel.com>2015-02-09 11:13:50 +0100
committerNeilBrown <neilb@suse.de>2015-02-11 15:27:57 +1100
commit19d3ea0f0b4decef347770b9b0d1a74fba4f7776 (patch)
tree6d1e313941bf473a1f8e1901cf459cd8d46aecd4
parent979b1feb093b1c2e0f8b58716329f2da092741d4 (diff)
downloadmdadm-19d3ea0f0b4decef347770b9b0d1a74fba4f7776.tar.gz
Monitor: fix for regression with container devices
This patch fixes 2 problems introduced by commit 9a518d8: not closing a file descriptor and ignoring container devices. Array state is always "inactive" for containers, so we make sure that the device is not a container by reading also the "level" sysfs entry. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Monitor.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Monitor.c b/Monitor.c
index 971d2ec..66d67ba 100644
--- 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) {