[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027150433.18193-17-k@mgml.me>
Date: Tue, 28 Oct 2025 00:04:33 +0900
From: Kenta Akagi <k@...l.me>
To: Song Liu <song@...nel.org>, Yu Kuai <yukuai@...as.com>,
Shaohua Li <shli@...com>, Mariusz Tkaczyk <mtkaczyk@...nel.org>,
Guoqing Jiang <jgq516@...il.com>
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
Kenta Akagi <k@...l.me>
Subject: [PATCH v5 16/16] md: Improve super_written() error logging
In the current implementation, when super_write fails, the output log
will be like this:
md: super_written gets error=-5
It is unless combined with other logs - e.g. I/O error message from blk,
it's impossible to determine which md and rdev are causing the problem,
and if the problem occurs on multiple devices, it becomes completely
impossible to determine from the logs where the super_write failed.
Also, currently super_written does not output logs when retrying
metadata write. If the metadata write fails, the array may be
corrupted, but if it is retried and successful, then it is not.
The user should be informed if a retry was attempted.
This commit adds output to see which array and which device had the
problem, and adds a message to indicate when a metadata write retry is
scheduled.
Signed-off-by: Kenta Akagi <k@...l.me>
---
drivers/md/md.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1cbb4fd8bbc0..4cbb31552486 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1058,10 +1058,13 @@ static void super_written(struct bio *bio)
struct mddev *mddev = rdev->mddev;
if (bio->bi_status) {
- pr_err("md: %s gets error=%d\n", __func__,
+ pr_err("md: %s: %pg: %s gets error=%d\n",
+ mdname(mddev), rdev->bdev, __func__,
blk_status_to_errno(bio->bi_status));
if (!md_cond_error(mddev, rdev, bio)
&& (bio->bi_opf & MD_FAILFAST)) {
+ pr_warn("md: %s: %pg: retrying metadata write\n",
+ mdname(mddev), rdev->bdev);
set_bit(MD_SB_NEED_REWRITE, &mddev->sb_flags);
set_bit(RetryingSBWrite, &rdev->flags);
}
--
2.50.1
Powered by blists - more mailing lists