From nobody Wed Sep 3 06:03:21 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58211FA3740 for ; Mon, 24 Oct 2022 12:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234128AbiJXMeF (ORCPT ); Mon, 24 Oct 2022 08:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234152AbiJXM32 (ORCPT ); Mon, 24 Oct 2022 08:29:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB1788DCA; Mon, 24 Oct 2022 05:03:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EDB91B811E0; Mon, 24 Oct 2022 12:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51F3CC433D7; Mon, 24 Oct 2022 12:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612843; bh=chCnK0CTUE8MKF84sALHRdUDz6uWT3Lh249NPivG9qI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHTm01rKIgI+yuO48s4aeQxaqpMO+hCwxRos3uJDAxrxsiuh3RHFdThKzgZlmQmxW As6p3ten/adgPboEhRM0IMjhvOLuW/nrl+kWcC1+55MleUxnaqycsbOm/kjAMV+bO6 QllOi8Xu9XOjeJupbv48lx63dHABgqiSk2eirRzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Logan Gunthorpe , Sasha Levin Subject: [PATCH 4.19 140/229] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024113003.540404190@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Logan Gunthorpe [ Upstream commit e2eed85bc75138a9eeb63863d20f8904ac42a577 ] 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-4aa9d2cea8= c1@deltatee.com/ Suggested-by: Song Liu Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- 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 6f04473f0838..3310f670a4ab 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3723,7 +3723,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; --=20 2.35.1