Message ID | 20230628015752.102267-2-linan666@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8600047vqr; Tue, 27 Jun 2023 19:05:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Dr/4IYUvCynJuL5RHDqWJstn9juhBpDdbLHotnnf1hqij8P1kSJ5LDs4Dcj/ZkCjMFRWC X-Received: by 2002:a05:6870:f152:b0:192:7328:d with SMTP id l18-20020a056870f15200b001927328000dmr33558377oac.4.1687917934422; Tue, 27 Jun 2023 19:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687917934; cv=none; d=google.com; s=arc-20160816; b=Mdnu6E88J0EQSnCFM+ntt6sOZycJ5uDMjPWlKtk8ETlamJ1A48QokRA+mW7B8RmRW+ 0j+RXbNOsnygk+OcVPBr0i7f+H4i3VFebU4FAVo3YjlRb6s2DqKn5PksO5fK0RsjMysZ zQRcNfelmsB3WYE63OfFEWLz/EwtJTg+Hn07ZYTMU8ffYNdFrYn+Hls0SPJKEnaVoh8g CKqVzu9iU6XyUctXEsVQTVeq5HbscwLsJ4C0jARnVQ2NaVIZMjsD6ua6zFTmVHu5VUZX j4IyaFtpNSVfOTqX+r0IS6pjEyW9kD/AmLroQuBp01iSfi1+iDFseiHAFe28hfwbMLah nVjA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=922AT9BKdUGh10349539Zt6bmYhC4x4QtI9IbYdZbQs=; fh=JelkcT0TRdrOgpvdXD11gpfIZj0vTNGVtwm25yueBk8=; b=KR3lZpSpRHBLy78l1NZ7Kbj+BlJhmK0hO+uFzHwM3iJ+6guzMc1Pe/kS8CSuxsnDuN Jq/75x6nCZqko5kuINauMt5/fxdKHPg5/szXIVbv4o3FoSN2QZcQnxCJ4ZhRqbS29mWM VxdytnaNPNcNFqVhUKxz6dpOBCgOkxB7u15U+rBq+B2BslVhKMOpXuUBY/Ug9aXm29m4 YQhjZzqNOAMR+kMyRZ9awccb6a0A47/bScR5UO3VCJ2xksj/kjPbaW0/3Jgkr2CUIAqm N4JmF+51K0RNmG1pSedZcoB5zbukOfQVWWfem7HXk9zBmCF0MZ9/MgoY1oQgUKwDYPyK SALg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a63d807000000b0055ace8caef9si5942421pgh.309.2023.06.27.19.05.20; Tue, 27 Jun 2023 19:05:34 -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 S231290AbjF1B7C (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Tue, 27 Jun 2023 21:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbjF1B6y (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Jun 2023 21:58:54 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BE952D58; Tue, 27 Jun 2023 18:58:48 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QrPrN4X4rz4f3pJT; Wed, 28 Jun 2023 09:58:44 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCH77LTk5tkJ6nJMg--.6175S5; Wed, 28 Jun 2023 09:58:45 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, guoqing.jiang@cloud.ionos.com, colyli@suse.de, xni@redhat.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan122@huawei.com, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH 1/3] md/raid10: check replacement and rdev to prevent submit the same io twice Date: Wed, 28 Jun 2023 09:57:50 +0800 Message-Id: <20230628015752.102267-2-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628015752.102267-1-linan666@huaweicloud.com> References: <20230628015752.102267-1-linan666@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCH77LTk5tkJ6nJMg--.6175S5 X-Coremail-Antispam: 1UD129KBjvdXoWrtrWxZw48Cr48Kw4fWFW3Jrb_yoWfurXEkw s5AF9aqr1xKF13Cwn0kr1IvrWDXw1qgFy7WrWYgrWYvFy5uryUKrW0gFZ7W3W5CrWDZr15 Ar1DKa1UArn8AjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbLkYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r18M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1lnxkEFVAIw20F6cxK64vIFxWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64 xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j 6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACI402YVCY1x02628vn2 kIc2xKxwAKzVCY07xG64k0F24lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij64vIr41l 4c8EcI0Ec7CjxVAaw2AFwI0_Jw0_GFyl4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWU JVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcq 2NDUUUU X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769910235919416559?= X-GMAIL-MSGID: =?utf-8?q?1769910235919416559?= |
Series |
raid10 bugfix
|
|
Commit Message
Li Nan
June 28, 2023, 1:57 a.m. UTC
From: Li Nan <linan122@huawei.com> After commit 4ca40c2ce099 ("md/raid10: Allow replacement device to be replace old drive."), 'rdev' and 'replacement' could appear to be identical. There are already checks for that in wait_blocked_dev() and raid10_write_request(). Add check for raid10_handle_discard() now. Signed-off-by: Li Nan <linan122@huawei.com> --- drivers/md/raid10.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
Hi, 在 2023/06/28 9:57, linan666@huaweicloud.com 写道: > From: Li Nan <linan122@huawei.com> > > After commit 4ca40c2ce099 ("md/raid10: Allow replacement device to be > replace old drive."), 'rdev' and 'replacement' could appear to be > identical. There are already checks for that in wait_blocked_dev() and > raid10_write_request(). Add check for raid10_handle_discard() now. > I'm working on synchronize io with array configuration, so that these checks is not necessary and can be removed, however, this might take some time, before that, this patch LGTM: Reviewed-by: Yu Kuai <yukuai3@huawei.com> > Signed-off-by: Li Nan <linan122@huawei.com> > --- > drivers/md/raid10.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index fabc340aae4f..3e6a09aaaba6 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -1811,6 +1811,8 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio) > r10_bio->devs[disk].bio = NULL; > r10_bio->devs[disk].repl_bio = NULL; > > + if (rdev == rrdev) > + rrdev = NULL; > if (rdev && (test_bit(Faulty, &rdev->flags))) > rdev = NULL; > if (rrdev && (test_bit(Faulty, &rrdev->flags))) >
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index fabc340aae4f..3e6a09aaaba6 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1811,6 +1811,8 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio) r10_bio->devs[disk].bio = NULL; r10_bio->devs[disk].repl_bio = NULL; + if (rdev == rrdev) + rrdev = NULL; if (rdev && (test_bit(Faulty, &rdev->flags))) rdev = NULL; if (rrdev && (test_bit(Faulty, &rrdev->flags)))