Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3519407rwe; Mon, 29 Aug 2022 13:35:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ArvXMjHV4U8zLACWQ/11ynBM0lFL21VHp9JrLFOhFX9O/kwNhU1Doqz+QewMRIZrrRHIm X-Received: by 2002:a17:907:e9e:b0:73e:933d:1c3d with SMTP id ho30-20020a1709070e9e00b0073e933d1c3dmr11302932ejc.622.1661805325147; Mon, 29 Aug 2022 13:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661805325; cv=none; d=google.com; s=arc-20160816; b=cFpshsJi56dFDaf+ESZJLixkM+CRG9GPBa3P/xb78ofiILrl8HnX6Z6AEOsacTYi76 9d1p0c98ZNzyVe0P8UtshmrbSHVClsgNsG3hmJ1D0lFx2seifto9fiGrz+n12i7swmtt /AoenY2dQfrjABjQNfZhU6v4R2kBEET/V9bKa1BoqGXJ33+fEL99Ke3CXF9hHpCsFdB6 hh69ShykUlkaCLAN9vdKF8qH8XCMF2q4wrdjWZzldWc5LZlmNb+rfZRFhap0SlWIlIH+ a/kEi44dR+ES+YlLbjU6djQReS/9+ufFHXI4smOuBiWZcB/LDKNl0tNdQWy0ADyWTii8 dbWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:subject:cc:to:from:date :message-id:content-transfer-encoding:mime-version; bh=RqSVVaIVUEfoZTmDQ1MIPLWjjppo2a8mtxJ8sXdJ43M=; b=YzkE9h/gZGnAminNQPtNorNEWo3tuvAje9XVghLEtFw39B6DQf7B+pYwvvMbLSQ0/R qAapI120WJDwM63o+mzQ2Fwbdvfa+1s+SB/GHBCrrlWyYBIYOyNHxUtMzcBeJsa0wUyz w/E6ZjRH6GD/ragQKpSswwDSKBL1oWvVLTauw+dyMHtFl6L+HrmGnaXk7jBXUoXxSe9U ENyLNePy391PWXuVu86Xpvj9kWF/8HbmgNabnfWhg0o0V20yEX6gc8D/bJMjiA37cH4+ Uuf+L42KXFWZHmmDcQBecBkfapfefhenHw0sXt+Qc9Ly/Cy7PHppktfuFV07nOC5e7re W92A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv18-20020a17090760d200b007417374cfafsi3644850ejc.844.2022.08.29.13.34.59; Mon, 29 Aug 2022 13:35: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbiH2TyC (ORCPT + 99 others); Mon, 29 Aug 2022 15:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiH2TyA (ORCPT ); Mon, 29 Aug 2022 15:54:00 -0400 Received: from mail.stoffel.org (li1843-175.members.linode.com [172.104.24.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E4E80524; Mon, 29 Aug 2022 12:53:59 -0700 (PDT) Received: from quad.stoffel.org (068-116-170-226.res.spectrum.com [68.116.170.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.stoffel.org (Postfix) with ESMTPSA id 85A4E2172C; Mon, 29 Aug 2022 15:53:58 -0400 (EDT) Received: by quad.stoffel.org (Postfix, from userid 1000) id A805FA7E37; Mon, 29 Aug 2022 15:53:57 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <25357.6485.659159.476926@quad.stoffel.home> Date: Mon, 29 Aug 2022 15:53:57 -0400 From: "John Stoffel" To: Yu Kuai Cc: song@kernel.org, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com Subject: Re: [PATCH -next 1/3] md/raid10: fix improper BUG_ON() in raise_barrier() In-Reply-To: <20220829131502.165356-2-yukuai1@huaweicloud.com> References: <20220829131502.165356-1-yukuai1@huaweicloud.com> <20220829131502.165356-2-yukuai1@huaweicloud.com> X-Mailer: VM 8.2.0b under 27.1 (x86_64-pc-linux-gnu) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 >>>>> "Yu" == Yu Kuai writes: Yu> From: Yu Kuai Yu> 'conf->barrier' is protected by 'conf->resync_lock', reading Yu> 'conf->barrier' without holding the lock is wrong. Yu> Signed-off-by: Yu Kuai Yu> --- Yu> drivers/md/raid10.c | 2 +- Yu> 1 file changed, 1 insertion(+), 1 deletion(-) Yu> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c Yu> index 9117fcdee1be..b70c207f7932 100644 Yu> --- a/drivers/md/raid10.c Yu> +++ b/drivers/md/raid10.c Yu> @@ -930,8 +930,8 @@ static void flush_pending_writes(struct r10conf *conf) Yu> static void raise_barrier(struct r10conf *conf, int force) Yu> { Yu> - BUG_ON(force && !conf->barrier); Yu> spin_lock_irq(&conf->resync_lock); Yu> + BUG_ON(force && !conf->barrier); I don't like this BUG_ON() at all, why are you crashing the system here instead of just doing a simple WARN_ONCE() instead? Is there anything the user can do to get into this situation on their own, or does it really signify a logic error in the code? If so, why are you killing the system? Yu> /* Wait until no block IO is waiting (unless 'force') */ Yu> wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting, Yu> -- Yu> 2.31.1