]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Monitor: Check redundancy for arrays
authorMariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Mon, 4 Sep 2017 10:52:46 +0000 (12:52 +0200)
committerJes Sorensen <jsorensen@fb.com>
Mon, 2 Oct 2017 19:44:14 +0000 (15:44 -0400)
GET_MISMATCH option doesn't exist for RAID arrays without redundancy
so sysfs_read fails if this information is requested. Set options
according to the device using information from /proc/mdstat.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Monitor.c

index 497e3642507be147536d7743c0b8d0f11e350156..b60996bf67b3f0ce28aede83c729ee078aa3ecf4 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -466,7 +466,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
        int new_array = 0;
        int retval;
        int is_container = 0;
-       unsigned long array_only_flags = 0;
+       unsigned long redundancy_only_flags = 0;
 
        if (test)
                alert("TestMessage", dev, NULL, ainfo);
@@ -504,11 +504,11 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
        if (md_get_array_info(fd, &array) < 0)
                goto disappeared;
 
-       if (!is_container)
-               array_only_flags |= GET_MISMATCH;
+       if (!is_container && map_name(pers, mse->level) > 0)
+               redundancy_only_flags |= GET_MISMATCH;
 
        sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_DISKS | GET_DEVS |
-                       GET_STATE | array_only_flags);
+                       GET_STATE | redundancy_only_flags);
 
        if (!sra)
                goto disappeared;