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>
This commit is contained in:
parent
979b1feb09
commit
19d3ea0f0b
|
@ -481,6 +481,10 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|||
read(fd, buf, 10) < 5 ||
|
||||
strncmp(buf,"clear",5) == 0 ||
|
||||
strncmp(buf,"inact",5) == 0) {
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
fd = sysfs_open(st->devnm, NULL, "level");
|
||||
if (fd < 0 || read(fd, buf, 10) != 0) {
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
if (!st->err)
|
||||
|
@ -489,6 +493,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
fd = open(dev, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
if (!st->err)
|
||||
|
|
Loading…
Reference in New Issue