From patchwork Mon Oct 24 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554920wru; Mon, 24 Oct 2022 09:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XUmSWuFdsNeJREMt2tNIPDnpRZ7ywJCv5e4b2TOLr9oy9QdUjwaZWu5TEogqNx6btzOFo X-Received: by 2002:a17:902:860a:b0:186:7eab:afa2 with SMTP id f10-20020a170902860a00b001867eabafa2mr17062256plo.46.1666630707177; Mon, 24 Oct 2022 09:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630707; cv=none; d=google.com; s=arc-20160816; b=qBzEFb13utRrE7qvumsQ07f7pHM03ksMy4AGAciucCOiZ4het0F9W5tJpRJuWd0fbL CqEw1ArS4ucuNI6TdFSnceopg6pgb/zpJipBy8eJCfP8h5ALfGbzqlkAfrONLO0f/vba crj0KMNQJYwWL24twkY9cobTBUcGdO0QPEztLiZOuARvxspA0DDs/2ihww6QkS9KCync F/7UxvuEKatWEM5qulaRHqZg6kR14Cxc8Y8UVTiRdMfZxzRjDzfrSKWw4uP4QEMe4j/R j+UtePcMDXuR9TLK8eDm7u0/40Tq+GV2/Zh5f19k9hACfEl/X2nSnFZMvs5k76BqsuHe Wtgg== 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=vcK4M4YiyIFOf+wZFwmwMFQf3g4okF8w/+i4hOBpfSw=; b=0FerzHOdGeN3MPki4V76/bZb9An/bylMIbBftDwaeW47wtNES6XmG5KZkio31sO10m Y6Yewyp/07YjcUXe7nIGp89XSoXJOVM+U0elTkZbk1tpYTHXK52fpNidogaS/YH/7zDu dMU7N6heITgkUBNDh7mQCxZ4goo8NbA5dIa50DtfQu5iOHQBh0K2/tBzDrVXmyExPuYe T1ngElf3O7qN5OxkCnP2CCksezdhLb9buWDNhxGOYDkehs8JsDDrN+R4JoNXdgx4nwSy sBXHb35kT9HlgBr6Sb3oMbDybCBXDxTORazUVRSOzoOuSYZY+zLfdBmYVoQ3KEPJEpuU 0Mkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P0ur2b5A; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z22-20020a63ac56000000b0046f13b048b6si13930pgn.168.2022.10.24.09.58.03; Mon, 24 Oct 2022 09:58:27 -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=P0ur2b5A; 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 S234147AbiJXQwu (ORCPT + 99 others); Mon, 24 Oct 2022 12:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235275AbiJXQtV (ORCPT ); Mon, 24 Oct 2022 12:49:21 -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 52A7A170DD2; Mon, 24 Oct 2022 08:32:38 -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 2994DB815C3; Mon, 24 Oct 2022 12:11:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77638C433C1; Mon, 24 Oct 2022 12:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613463; bh=aWsSx6tS4BASewcQgz+ogKnVR4asshbALXf6ZioxJWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0ur2b5AA2sQZ6F0Y5pJxHuQUnB35pyyO4uxFFKaeFelSTqfr5JzUmL6R+TZFNCLj 2OhaUvHf5ganfNsrEMBDhCW7Pe/q/hMjueU2L4DJuAldBiz22jLu8LrJlyJMm2vgOl Wu8PgIkePKO+CSGzXsNZNptYeG1tY2tAdVfZ5zUA= 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 5.4 146/255] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113007.480134270@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588960103505998?= X-GMAIL-MSGID: =?utf-8?q?1747588960103505998?= 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 fe99e8cdc026..a7753e859ea9 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3728,7 +3728,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;