Skip to contentSkip to conversation

md: report failed arrays as broken in mdstat

PATCH Applied Mateusz Kusiak 2 participants 2 messages Sep 3, 2024 – Sep 5, 2024 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md: report failed arrays as broken in mdstat

Depening 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.

---
 drivers/md/md.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/md/md.c +7 -2
index d3a837506a36..28d9898e9173 100644
@@ -8390,14 +8390,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;
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 10 lines · Mateusz Kusiak

Depening 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.

Applied to md-6.12.

Thanks,
Song