Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7031218rwi; Mon, 24 Oct 2022 09:01:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cwGN+rXOPOVkEutaU0BL7ECMbLCIrjavmGiTKAyDlP5bth/PkkGN0z+LPIY4VAdYmtMlW X-Received: by 2002:a17:907:3e9c:b0:78d:ce8b:8548 with SMTP id hs28-20020a1709073e9c00b0078dce8b8548mr29019092ejc.427.1666627285281; Mon, 24 Oct 2022 09:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627285; cv=none; d=google.com; s=arc-20160816; b=NvPHNRQ5DL+YmVfzR38WnkIz4y0+Q6IVSrrjzgYmnwVULMBlvcxXGMuAvvXwYnku5h J+4hg1uZ+CEfyTJq5Sya4ronft4LtHHbmuB8ixRa+izpp4UaI4bYOQS/MO/2pcZb4OXD mDxvHdqS5j0o9vL/mLmQFNaDHGIpi6XOfPvL8qH6t2ycC/EbV866CGqno6IQPAKU+LDu Yo3th+o38jrVZ4QYaigjKmtQruHdRg4YBBj4OVkYnjSVAlYugy2DYjlEJGabRV5OUVzS WuXkiMNfjGwr+x8RAaIKm2skrRLmxiWhjKXqUP/utWmlImT8I0VUmOw9Wz2hQd19BpUE zvwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g8AqR1Nw+RvNflhPsHCN++X0+lJPVp0xXa6CcPt3F0Q=; b=tn860szuPv1ezgI5V5sWXsmwrRdO05ccP5K2VfrQlrn2Sw5zcTOEhnxrReA46ol2w4 X+2Bb2mBzIX5XPRtjsxo3xrrngLw63DUZtS3jqYOwDjZ8z+2wJAT/yy+KZpV0ncvaQoD +TUgC+R2JGiA4M3SbfXf9kGvbHjnOtLpc5bU2pppu0v/5pEgcPdZT5WnfVLwyQd+DEfi hUQ/pA/gycPls38J4ceoey5tI1pIj+f9jx0yF1s4yvCE4VRjeDsd/hazHiJ2zx/+OpI2 G8z9ELl0+wXRu0TF1j21jtsii4lylIA9LyA3uuyhPQZwd94x4Kp60b8RudAViTguivPy EpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QO1uyp6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds1-20020a170907724100b007ab1b8b719csi178506ejc.0.2022.10.24.09.00.55; Mon, 24 Oct 2022 09:01:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QO1uyp6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231295AbiJXPxK (ORCPT + 99 others); Mon, 24 Oct 2022 11:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231797AbiJXPwx (ORCPT ); Mon, 24 Oct 2022 11:52:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7D63CE5; Mon, 24 Oct 2022 07:47:32 -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 sin.source.kernel.org (Postfix) with ESMTPS id 3A058CE1353; Mon, 24 Oct 2022 11:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D1D6C433D6; Mon, 24 Oct 2022 11:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612289; bh=ipcBAw3C0ZMweEZtqlR6OMDjjvMZt6qpdLB5DJIjctM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QO1uyp6hkd5Vxvygs73CskbEBSS3DwlprNK+OtbwexxHFAN0IYc2CH+i2aQrd0e0F mGBZRmIG1hxS/EvWnOjdknVpKws3XCr48PPbi3Hr7qPkNEECUm4+o+cUiv0ccltpKE 5yu+HdWiBLms+Pmg8vWG1XCzMEEXKOXWhUMRmaOs= 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.14 134/210] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024113001.347618087@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-4aa9d2cea8c1@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 866ba1743f9f..78b48dca3fda 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3720,7 +3720,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; -- 2.35.1