Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2762319rwd; Sun, 28 May 2023 23:56:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PgLSHUiQQZifx1m0fnNF7+Tv9oAO6tELe1OeO/lkOAM1YuZLYrdOQBGEEmaa0VkFnkwmb X-Received: by 2002:a17:90a:3ec6:b0:256:614f:d39f with SMTP id k64-20020a17090a3ec600b00256614fd39fmr5126098pjc.5.1685343404347; Sun, 28 May 2023 23:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685343404; cv=none; d=google.com; s=arc-20160816; b=a0nUH1zX4JO5E6u9DNVJ1shTov3eOkrgP+JSe8pVh+onLGgebd3bcsjjNVVwWL9rdw 3WDQtNJqvTccH1oSum3fatME0oBAsFK73uDNDx6HFPEsj27F9Y3gEttDGHSRPAXNm0nx pE4lq7F6znSvUtcAY6p0IF6kmitl8IssHPZO7hMd8zM/bKepk1J9Hmq7JMnRuvt+21u3 mdHS/ZQCUX65uM9Vss+lSsTAgyjKsjqUF7iWT8+1mRxOF7I7uDLjEGBbee22xuW/MZy8 OwBl3A2wqKa7yVvk7yNIpl77hVNmiVnClsMhfkSzOeqKlxNra51JPi+qWXigzXtKRnu8 Kvug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=1lD7ObRlKaQbgCX9oPxSiZbmE4QBycFCTN7tGZMhAnw=; b=UZxC0qAaqQ6bCaLc2XorF8wKTzBWiLkYTb4aitt46NQFIuSy+WypVvNyfBncB6lr4z 0bx2a5BoUbG4CHbUtWsrvtJG2yGTg6nGUHmUrBUt5PNURNJ+Q/YPRrWNZLF0XlmGy+ht Qjh4eRMtqO0+LmpJdQ49wkmzIVilsyonYTjqb1f/3VQchZFclnZUhe+7OsoRl3i6kwEm 7raD4t+15RcvvPnbCAHnwa6TsRZrN6M5E5PO6oRboklvaUAJRdGgacr6nmmY1ETWJz8s Q2SLJxLlJIeH2pHl2gRT9Dq5VMcqXHu/IzkBWMsAT1nZhc95IoAquboRIfxze9f9KFXG GUkw== 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 mm14-20020a17090b358e00b0023418ec51f8si11290775pjb.136.2023.05.28.23.56.32; Sun, 28 May 2023 23:56:44 -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 S231718AbjE2Goz (ORCPT + 99 others); Mon, 29 May 2023 02:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbjE2Gox (ORCPT ); Mon, 29 May 2023 02:44:53 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BA7190; Sun, 28 May 2023 23:44:50 -0700 (PDT) Received: from [192.168.0.185] (unknown [95.90.238.95]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id E30B961DFA908; Mon, 29 May 2023 08:44:04 +0200 (CEST) Message-ID: <6074a7aa-bb9c-6803-dd94-bba208d47ba0@molgen.mpg.de> Date: Mon, 29 May 2023 08:44:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH -next] md/raid5: don't allow concurrent reshape with recovery To: Yu Kuai Cc: song@kernel.org, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com References: <20230529031045.1760883-1-yukuai1@huaweicloud.com> Content-Language: en-US From: Paul Menzel In-Reply-To: <20230529031045.1760883-1-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 Dear Yu, Thank you for your patch. As always some minor commons, you can also ignore. Am 29.05.23 um 05:10 schrieb Yu Kuai: > From: Yu Kuai > > commit 0aecb06e2249 ("md/raid5: don't allow replacement while reshape I’d start with a capital letter: Commit … > is in progress") fix that replacement can be set if reshape is fixes > interrupted, which will cause that array can't be assemebled. assembled > There is a similar on the other side, if recovery is interrupted, then similar *problem*? > reshape can start, which will cause the same problem. > > Fix the prblem by don't start reshape is recovery is still in progress. • problem • … by not starting to reshape while recovery is still in progress > Signed-off-by: Yu Kuai > --- > drivers/md/raid5.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > index 64865f9dd3f5..6db783ca71b7 100644 > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c > @@ -8500,6 +8500,7 @@ static int raid5_start_reshape(struct mddev *mddev) > struct r5conf *conf = mddev->private; > struct md_rdev *rdev; > int spares = 0; > + int i; It won’t make a difference for the code I believe, but as the count variable can’t be negative, I’d use `unsigned int`. > unsigned long flags; > > if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) > @@ -8511,6 +8512,13 @@ static int raid5_start_reshape(struct mddev *mddev) > if (has_failed(conf)) > return -EINVAL; > > + /* raid5 can't handle concurrent reshape and recovery */ > + if (mddev->recovery_cp < MaxSector) > + return -EBUSY; > + for (i = 0; i < conf->raid_disks; i++) > + if (rdev_mdlock_deref(mddev, conf->disks[i].replacement)) > + return -EBUSY; > + > rdev_for_each(rdev, mddev) { > if (!test_bit(In_sync, &rdev->flags) > && !test_bit(Faulty, &rdev->flags)) Kind regards, Paul