Re: raid5 Journal Recovery Bug
From: Song Liu <song@kernel.org>
Date: 2022-08-22 19:13:43
On Mon, Aug 22, 2022 at 9:28 AM Logan Gunthorpe [off-list ref] wrote:
On 2022-08-22 01:04, Song Liu wrote:quoted
Could you please add some printk so that we know which condition triggered handle_stripe_fill() here: if (s.to_read || s.non_overwrite || (s.to_write && s.failed) || (s.syncing && (s.uptodate + s.compute < disks)) || s.replacing || s.expanding) handle_stripe_fill(sh, &s, disks); This would help us narrow down to the exact condition. I guess it is "(s.to_write && s.failed)", but I am not quite sure.Ok, I hit this bug on a stripe and got these values for the call: to_read = 0 non_overwrite = 0 to_write = 0 failed = 1 syncing = 1 uptodate = 2 compute = 0 disks = 3 replacing = 0 expanding = 0 So it's actually the "(s.syncing && (s.uptodate + s.compute < disks))" condition that is getting hit.
Thanks for the information! So the stripe is syncing. Could you please try whether the following fixes the issue? Thanks, Song
diff --git i/drivers/md/raid5.c w/drivers/md/raid5.c
index 5cabdbbac48b..0580ebb11801 100644
--- i/drivers/md/raid5.c
+++ w/drivers/md/raid5.c@@ -3952,7 +3952,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out;