]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
md: Report failed arrays as broken in mdstat
authorMateusz Kusiak <mateusz.kusiak@intel.com>
Tue, 3 Sep 2024 14:29:49 +0000 (16:29 +0200)
committerSong Liu <song@kernel.org>
Wed, 4 Sep 2024 21:52:45 +0000 (14:52 -0700)
Depending on if array has personality, it is either reported as active or
inactive. This patch adds third status "broken" for arrays with
personality that became inoperative. The reason is end users tend to
assume that "active" indicates array is operational.

Add "broken" state for inoperative arrays with personality and refactor
the code.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Link: https://lore.kernel.org/r/20240903142949.53628-1-mateusz.kusiak@intel.com
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md.c

index 41414611142535f477c4d86c709c6de139db53ce..b669971d47822c309245be1b982dc91d9ebab3ce 100644 (file)
@@ -8327,14 +8327,19 @@ static int md_seq_show(struct seq_file *seq, void *v)
        spin_unlock(&all_mddevs_lock);
        spin_lock(&mddev->lock);
        if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
-               seq_printf(seq, "%s : %sactive", mdname(mddev),
-                                               mddev->pers ? "" : "in");
+               seq_printf(seq, "%s : ", mdname(mddev));
                if (mddev->pers) {
+                       if (test_bit(MD_BROKEN, &mddev->flags))
+                               seq_printf(seq, "broken");
+                       else
+                               seq_printf(seq, "active");
                        if (mddev->ro == MD_RDONLY)
                                seq_printf(seq, " (read-only)");
                        if (mddev->ro == MD_AUTO_READ)
                                seq_printf(seq, " (auto-read-only)");
                        seq_printf(seq, " %s", mddev->pers->name);
+               } else {
+                       seq_printf(seq, "inactive");
                }
 
                sectors = 0;