Skip to content

Commit 2d2b3bc

Browse files
dancesWithMachinesliu-song-6
authored andcommitted
md: Report failed arrays as broken in mdstat
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Song Liu <[email protected]>
1 parent fb16787 commit 2d2b3bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/md/md.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8327,14 +8327,19 @@ static int md_seq_show(struct seq_file *seq, void *v)
83278327
spin_unlock(&all_mddevs_lock);
83288328
spin_lock(&mddev->lock);
83298329
if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
8330-
seq_printf(seq, "%s : %sactive", mdname(mddev),
8331-
mddev->pers ? "" : "in");
8330+
seq_printf(seq, "%s : ", mdname(mddev));
83328331
if (mddev->pers) {
8332+
if (test_bit(MD_BROKEN, &mddev->flags))
8333+
seq_printf(seq, "broken");
8334+
else
8335+
seq_printf(seq, "active");
83338336
if (mddev->ro == MD_RDONLY)
83348337
seq_printf(seq, " (read-only)");
83358338
if (mddev->ro == MD_AUTO_READ)
83368339
seq_printf(seq, " (auto-read-only)");
83378340
seq_printf(seq, " %s", mddev->pers->name);
8341+
} else {
8342+
seq_printf(seq, "inactive");
83388343
}
83398344

83408345
sectors = 0;

0 commit comments

Comments
 (0)