* [PATCH] md/raid5: Ensure stripe_fill happens on non-read IO with journal
@ 2022-08-25 15:46 Logan Gunthorpe
2022-08-29 22:28 ` Song Liu
0 siblings, 1 reply; 2+ messages in thread
From: Logan Gunthorpe @ 2022-08-25 15:46 UTC (permalink / raw)
To: Song Liu, linux-raid; +Cc: David Sloan, Logan Gunthorpe
When doing degrade/recover tests using the journal a kernel BUG
is hit at drivers/md/raid5.c:4381 in handle_parity_checks5():
BUG_ON(!test_bit(R5_UPTODATE, &dev->flags));
This was found to occur because handle_stripe_fill() was skipped
for stripes in the journal due to a condition in that function.
Thus blocks were not fetched and R5_UPTODATE was not set when
the code reached handle_parity_checks5().
To fix this, don't skip handle_stripe_fill() unless the stripe is
for read.
Fixes: 07e83364845e ("md/r5cache: shift complex rmw from read path to write path")
Link: https://lore.kernel.org/linux-raid/e05c4239-41a9-d2f7-3cfa-4aa9d2cea8c1@deltatee.com/
Suggested-by: Song Liu <song@kernel.org>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
drivers/md/raid5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 31a0cbf63384..4ec33fd62018 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4047,7 +4047,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;
base-commit: ba5f3643ff6eed7300fd0cfb327ecb48a8be3fb6
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md/raid5: Ensure stripe_fill happens on non-read IO with journal
2022-08-25 15:46 [PATCH] md/raid5: Ensure stripe_fill happens on non-read IO with journal Logan Gunthorpe
@ 2022-08-29 22:28 ` Song Liu
0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2022-08-29 22:28 UTC (permalink / raw)
To: Logan Gunthorpe; +Cc: linux-raid, David Sloan
On Thu, Aug 25, 2022 at 8:46 AM Logan Gunthorpe <logang@deltatee.com> wrote:
>
> When doing degrade/recover tests using the journal a kernel BUG
> is hit at drivers/md/raid5.c:4381 in handle_parity_checks5():
>
> BUG_ON(!test_bit(R5_UPTODATE, &dev->flags));
>
> This was found to occur because handle_stripe_fill() was skipped
> for stripes in the journal due to a condition in that function.
> Thus blocks were not fetched and R5_UPTODATE was not set when
> the code reached handle_parity_checks5().
>
> To fix this, don't skip handle_stripe_fill() unless the stripe is
> for read.
>
> Fixes: 07e83364845e ("md/r5cache: shift complex rmw from read path to write path")
> Link: https://lore.kernel.org/linux-raid/e05c4239-41a9-d2f7-3cfa-4aa9d2cea8c1@deltatee.com/
> Suggested-by: Song Liu <song@kernel.org>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Applied to md-next. Thanks!
Song
> ---
> drivers/md/raid5.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 31a0cbf63384..4ec33fd62018 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -4047,7 +4047,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;
>
> base-commit: ba5f3643ff6eed7300fd0cfb327ecb48a8be3fb6
> --
> 2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-29 22:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 15:46 [PATCH] md/raid5: Ensure stripe_fill happens on non-read IO with journal Logan Gunthorpe
2022-08-29 22:28 ` Song Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.