Thread (25 messages) 25 messages, 4 authors, 2022-01-26

Re: [PATCH 1/3] raid0, linear, md: add error_handlers for raid0 and linear

From: Mariusz Tkaczyk <hidden>
Date: 2021-12-20 09:39:19

Hi Guoqing,
On Fri, 17 Dec 2021 10:00:25 +0800
Guoqing Jiang [off-list ref] wrote:
quoted
@@ -281,6 +282,17 @@ static void linear_status (struct seq_file
*seq, struct mddev *mddev) seq_printf(seq, " %dk rounding",
mddev->chunk_sectors / 2); }
  
+static void linear_error(struct mddev *mddev, struct md_rdev *rdev)
+{
+	char b[BDEVNAME_SIZE];
+
+	if (!test_and_set_bit(MD_BROKEN, &rdev->mddev->flags))
+		pr_crit("md/linear%s: Disk failure on %s
detected.\n"
+			"md/linear:%s: Cannot continue, failing
array.\n",
+			mdname(mddev), bdevname(rdev->bdev, b),
+			mdname(mddev));
+}
+  
Do you consider to use %pg to print block device?
 
Will do.
 
quoted
@@ -588,6 +589,17 @@ static void raid0_status(struct seq_file *seq,
struct mddev *mddev) return;
  }
  
+static void raid0_error(struct mddev *mddev, struct md_rdev *rdev)
+{
+	char b[BDEVNAME_SIZE];
+
+	if (!test_and_set_bit(MD_BROKEN, &rdev->mddev->flags))
+		pr_crit("md/raid0%s: Disk failure on %s
detected.\n"
+			"md/raid0:%s: Cannot continue, failing
array.\n",
+			mdname(mddev), bdevname(rdev->bdev, b),
+			mdname(mddev));
+}
+
  static void *raid0_takeover_raid45(struct mddev *mddev)
  {
  	struct md_rdev *rdev;
@@ -763,6 +775,7 @@ static struct md_personality raid0_personality=
  	.size		= raid0_size,
  	.takeover	= raid0_takeover,
  	.quiesce	= raid0_quiesce,
+	.error_handler	= raid0_error,
  };
    
What is the advantage of adding error_handler for raid0 and linear?
IOW, without implement the error_handler, is there some existing
issue?
There is no issue. It was suggested by Song:
https://lore.kernel.org/linux-raid/CAPhsuW4X94eJ8aG6i7F0zCmgjuWHSRWuBH2gOJjTe5uWg_rMvQ@mail.gmail.com/ (local)

Thanks,
Mariusz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help