diff mbox series

md: report failed arrays as broken in mdstat

Message ID 20240903142949.53628-1-mateusz.kusiak@intel.com (mailing list archive)
State Accepted
Headers show
Series md: report failed arrays as broken in mdstat | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_12-PR success PR summary
mdraidci/vmtest-md-6_12-VM_Test-0 success Logs for per-patch-testing

Commit Message

Mateusz Kusiak Sept. 3, 2024, 2:29 p.m. UTC
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.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
---
 drivers/md/md.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Song Liu Sept. 5, 2024, 5:49 a.m. UTC | #1
On Tue, Sep 3, 2024 at 7:29 AM Mateusz Kusiak <mateusz.kusiak@intel.com> wrote:
>
> 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.
>
> Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>

Applied to md-6.12.

Thanks,
Song
diff mbox series

Patch

diff --git a/drivers/md/md.c b/drivers/md/md.c
index d3a837506a36..28d9898e9173 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -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;