From: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
To: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Mateusz Jończyk" <mat.jonczyk@o2.pl>,
"Yu Kuai" <yukuai3@huawei.com>, "Song Liu" <song@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH] [DEBUG] md/raid1: check recovery_offset in raid1_check_read_range
Date: Sun, 28 Jul 2024 12:36:34 +0200 [thread overview]
Message-ID: <20240728103634.208234-1-mat.jonczyk@o2.pl> (raw)
In-Reply-To: <9952f532-2554-44bf-b906-4880b2e88e3a@o2.pl>
This should fix the filesystem corruption during RAID resync.
Checking this condition in raid1_check_read_range is not ideal, but this
is only a debug patch.
Link: https://lore.kernel.org/lkml/20240724141906.10b4fc4e@peluse-desk5/T/#m671d6d3a7eda44d39d0882864a98824f52c52917
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Cc: Yu Kuai <yukuai3@huawei.com>
Cc: Song Liu <song@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/md/raid1-10.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
index 2ea1710a3b70..4ab896e8cb12 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.c
@@ -252,6 +252,10 @@ static inline int raid1_check_read_range(struct md_rdev *rdev,
sector_t first_bad;
int bad_sectors;
+ if (!test_bit(In_sync, &rdev->flags) &&
+ rdev->recovery_offset < this_sector + *len)
+ return 0;
+
/* no bad block overlap */
if (!is_badblock(rdev, this_sector, *len, &first_bad, &bad_sectors))
return *len;
--
2.25.1
next prev parent reply other threads:[~2024-07-28 10:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-20 14:47 Filesystem corruption when adding a new device (delayed-resync, write-mostly) Mateusz Jończyk
2024-07-22 5:39 ` Mateusz Jończyk
2024-07-24 20:35 ` Filesystem corruption when adding a new RAID " Mateusz Jończyk
2024-07-24 21:19 ` Paul E Luse
2024-07-25 7:15 ` Mateusz Jończyk
2024-07-25 14:27 ` Paul E Luse
2024-07-28 10:30 ` [REGRESSION] " Mateusz Jończyk
2024-07-30 20:35 ` Mateusz Jończyk
2024-07-31 1:10 ` Yu Kuai
2024-07-28 10:36 ` Mateusz Jończyk [this message]
2024-07-29 1:30 ` [PATCH] [DEBUG] md/raid1: check recovery_offset in raid1_check_read_range Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240728103634.208234-1-mat.jonczyk@o2.pl \
--to=mat.jonczyk@o2.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox