Message ID | 20230601062424.3613218-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 k13csp94179vqr; Wed, 31 May 2023 23:44:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6g9Lmcax4g2xjZ4reGLNOJIdqinkzHo40LkKo6DKc4BQfAkqnh1a1gJUeKYKLZXL/wDaFw X-Received: by 2002:aca:1814:0:b0:397:f82f:90a4 with SMTP id h20-20020aca1814000000b00397f82f90a4mr6058594oih.3.1685601888818; Wed, 31 May 2023 23:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685601888; cv=none; d=google.com; s=arc-20160816; b=el8X4bVIgVqZhE+1Ed8HmZIy53iwZEKQuSDNZQUDwL6aAEeI3iELtaCvcduwuV0GYn zQ0cb3w1nHTOSwHn9jnl3+ppu/q9Ix+iv92reL6VQq1Do62xOON6aVcJxGPIMRFrSMX/ 9PV5QYwhy6LXXHUbW5qqEN+0g1JyRE5nMtyDwd2EPU/NxcXVAFfA2i/BOUrhXi9x6tDY VHHjQuPHVk/EDlw+D27qveHEp1TEOn3Gz3pLzUjkaGUCdDHWqbuSIfUK2QWAZgMeOA5V fK2BLiDTYDScFW9s10yjMoReeO3TH8QaNkkjj7+fflwQBYh9Oa16pDCodob92y3oY99+ K0WA== 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=8HmR04kDJnyt07Z6RGJQJdiZgt5tDulpgJOQFv5jnHM=; b=JhRfo24CSMC/j/9jhD6NhZWMMV19m7Wd7o7zta/bHVAOmXnngcyB2CaEt9Bv/DnSu4 AMZ4lsblkwxW3WfCMrKsfBBqp6VHn0jyXv0adNJVam6KQrMoBqmDLuJKF5SmO9qhtrd7 pCM3SvPC6rqlYShOtpHkPW3+gjeabfo8nHt8HlDC9u1ghNB38uNz9EAan444NfWHYlVa I4k5pp9uJ6mUkjtukYyO7omjBOhP51/PI9/p5Rews+kURdvtB0lpSMlH0dAZM/66nbhj wt84XlaJXMORlSHp+pPBjrrhyM34APh9xElgCl8h7TYTkB0hsD1TJ+OieVD4ooeQz5zk z2MA== 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 c12-20020a170903234c00b001b02bd00c67si931828plh.324.2023.05.31.23.44.32; Wed, 31 May 2023 23:44:48 -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 S231523AbjFAG0R (ORCPT <rfc822;limurcpp@gmail.com> + 99 others); Thu, 1 Jun 2023 02:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230419AbjFAG0P (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 1 Jun 2023 02:26:15 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050119D; Wed, 31 May 2023 23:26:13 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QWx3M6cnSz4f3nwJ; Thu, 1 Jun 2023 14:26:07 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgBnHbH_OXhko4G0Kg--.24198S5; Thu, 01 Jun 2023 14:26:09 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, neilb@suse.de 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 v5 1/2] md/raid10: fix incorrect done of recovery Date: Thu, 1 Jun 2023 14:24:23 +0800 Message-Id: <20230601062424.3613218-2-linan666@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230601062424.3613218-1-linan666@huaweicloud.com> References: <20230601062424.3613218-1-linan666@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBnHbH_OXhko4G0Kg--.24198S5 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw17JF4kCrykXr1fXF45Awb_yoW8try8pa n7JF93t3s8X3yfJ3WDAryUXFWFy348Ja43KrWxW34jgayaqr9rZFWxXFW0qFyUWF1FqFWY qw4DJrW5CF97KaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBGb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2vYz4IE04k24VAvwVAKI4IrM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrV ACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWU JVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lw4CEc2x0rVAKj4xxMx AIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_ Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwI xGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWx JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcV C2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x07jbjjgUUUUU= X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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?1767481685788499622?= X-GMAIL-MSGID: =?utf-8?q?1767481685788499622?= |
Series |
raid10 bugfix
|
|
Commit Message
Li Nan
June 1, 2023, 6:24 a.m. UTC
From: Li Nan <linan122@huawei.com> In raid10_sync_request(), if data cannot be read from any disk for recovery, it will go to 'giveup' and let 'chunks_skipped' + 1. After multiple 'giveup', when 'chunks_skipped >= geo.raid_disks', it will return 'max_sector', indicating that the recovery has been completed. However, the recovery is just aborted and the data remains inconsistent. Fix it by setting mirror->recovery_disabled, which will prevent the spare disk from being added to this mirror. The same issue also exists during resync, it will be fixed afterwards. Signed-off-by: Li Nan <linan122@huawei.com> --- drivers/md/raid10.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
Comments
Dear Li, Thank you for your patch. Am 01.06.23 um 08:24 schrieb linan666@huaweicloud.com: > From: Li Nan <linan122@huawei.com> Unfortunately, I do not understand your commit message summary “fix incorrect done of recovery”. Maybe: Do not add sparse disk when recovery aborts > In raid10_sync_request(), if data cannot be read from any disk for > recovery, it will go to 'giveup' and let 'chunks_skipped' + 1. After > multiple 'giveup', when 'chunks_skipped >= geo.raid_disks', it will > return 'max_sector', indicating that the recovery has been completed. > However, the recovery is just aborted and the data remains inconsistent. > > Fix it by setting mirror->recovery_disabled, which will prevent the spare > disk from being added to this mirror. The same issue also exists during > resync, it will be fixed afterwards. > > Signed-off-by: Li Nan <linan122@huawei.com> > --- > drivers/md/raid10.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index d93d8cb2b620..3ba1516ea160 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -3303,6 +3303,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, > int chunks_skipped = 0; > sector_t chunk_mask = conf->geo.chunk_mask; > int page_idx = 0; > + int error_disk = -1; > > /* > * Allow skipping a full rebuild for incremental assembly > @@ -3386,7 +3387,20 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, > return reshape_request(mddev, sector_nr, skipped); > > if (chunks_skipped >= conf->geo.raid_disks) { > - /* if there has been nothing to do on any drive, > + pr_err("md/raid10:%s: %s fail\n", mdname(mddev), > + test_bit(MD_RECOVERY_SYNC, &mddev->recovery) ? "resync" : "recovery"); > + if (error_disk >= 0 && > + !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { > + /* > + * recovery fail, set mirrors.recovory_disabled, recov*e*ry > + * device shouldn't be added to there. > + */ > + conf->mirrors[error_disk].recovery_disabled = > + mddev->recovery_disabled; > + return 0; > + } > + /* > + * if there has been nothing to do on any drive, > * then there is nothing to do at all.. Just one dot/period at the end? > */ > *skipped = 1; > @@ -3638,6 +3652,8 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, > mdname(mddev)); > mirror->recovery_disabled > = mddev->recovery_disabled; > + } else { > + error_disk = i; > } > put_buf(r10_bio); > if (rb2) Kind regards, Paul
在 2023/6/1 15:06, Paul Menzel 写道: > Dear Li, > > > Thank you for your patch. > > Am 01.06.23 um 08:24 schrieb linan666@huaweicloud.com: >> From: Li Nan <linan122@huawei.com> > > Unfortunately, I do not understand your commit message summary “fix > incorrect done of recovery”. Maybe: > > Do not add sparse disk when recovery aborts > "recovery fail" is better? >> In raid10_sync_request(), if data cannot be read from any disk for >> recovery, it will go to 'giveup' and let 'chunks_skipped' + 1. After >> multiple 'giveup', when 'chunks_skipped >= geo.raid_disks', it will >> return 'max_sector', indicating that the recovery has been completed. >> However, the recovery is just aborted and the data remains inconsistent. >> >> Fix it by setting mirror->recovery_disabled, which will prevent the spare >> disk from being added to this mirror. The same issue also exists during >> resync, it will be fixed afterwards. >> >> Signed-off-by: Li Nan <linan122@huawei.com> >> --- >> drivers/md/raid10.c | 18 +++++++++++++++++- >> 1 file changed, 17 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c >> index d93d8cb2b620..3ba1516ea160 100644 >> --- a/drivers/md/raid10.c >> +++ b/drivers/md/raid10.c >> @@ -3303,6 +3303,7 @@ static sector_t raid10_sync_request(struct mddev >> *mddev, sector_t sector_nr, >> int chunks_skipped = 0; >> sector_t chunk_mask = conf->geo.chunk_mask; >> int page_idx = 0; >> + int error_disk = -1; >> /* >> * Allow skipping a full rebuild for incremental assembly >> @@ -3386,7 +3387,20 @@ static sector_t raid10_sync_request(struct >> mddev *mddev, sector_t sector_nr, >> return reshape_request(mddev, sector_nr, skipped); >> if (chunks_skipped >= conf->geo.raid_disks) { >> - /* if there has been nothing to do on any drive, >> + pr_err("md/raid10:%s: %s fail\n", mdname(mddev), >> + test_bit(MD_RECOVERY_SYNC, &mddev->recovery) ? "resync" >> : "recovery"); >> + if (error_disk >= 0 && >> + !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { >> + /* >> + * recovery fail, set mirrors.recovory_disabled, > > recov*e*ry > >> + * device shouldn't be added to there. >> + */ >> + conf->mirrors[error_disk].recovery_disabled = >> + mddev->recovery_disabled; >> + return 0; >> + } >> + /* >> + * if there has been nothing to do on any drive, >> * then there is nothing to do at all.. > > Just one dot/period at the end? > Thanks for your suggestion. I will change it in next version.
Dear Li Nan, Am 02.06.23 um 08:57 schrieb Li Nan: > 在 2023/6/1 15:06, Paul Menzel 写道: >> Am 01.06.23 um 08:24 schrieb linan666@huaweicloud.com: >>> From: Li Nan <linan122@huawei.com> >> >> Unfortunately, I do not understand your commit message summary “fix >> incorrect done of recovery”. Maybe: >> >> Do not add sparse disk when recovery aborts > > "recovery fail" is better? I think the grammar is incorrect, and it should be fail*s*. […] Kind regards, Paul
在 2023/6/2 16:33, Paul Menzel 写道: > Dear Li Nan, > > > Am 02.06.23 um 08:57 schrieb Li Nan: > >> 在 2023/6/1 15:06, Paul Menzel 写道: > >>> Am 01.06.23 um 08:24 schrieb linan666@huaweicloud.com: >>>> From: Li Nan <linan122@huawei.com> >>> >>> Unfortunately, I do not understand your commit message summary “fix >>> incorrect done of recovery”. Maybe: >>> >>> Do not add sparse disk when recovery aborts >> >> "recovery fail" is better? > > I think the grammar is incorrect, and it should be fail*s*. > fix in v7. :)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d93d8cb2b620..3ba1516ea160 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3303,6 +3303,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, int chunks_skipped = 0; sector_t chunk_mask = conf->geo.chunk_mask; int page_idx = 0; + int error_disk = -1; /* * Allow skipping a full rebuild for incremental assembly @@ -3386,7 +3387,20 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, return reshape_request(mddev, sector_nr, skipped); if (chunks_skipped >= conf->geo.raid_disks) { - /* if there has been nothing to do on any drive, + pr_err("md/raid10:%s: %s fail\n", mdname(mddev), + test_bit(MD_RECOVERY_SYNC, &mddev->recovery) ? "resync" : "recovery"); + if (error_disk >= 0 && + !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { + /* + * recovery fail, set mirrors.recovory_disabled, + * device shouldn't be added to there. + */ + conf->mirrors[error_disk].recovery_disabled = + mddev->recovery_disabled; + return 0; + } + /* + * if there has been nothing to do on any drive, * then there is nothing to do at all.. */ *skipped = 1; @@ -3638,6 +3652,8 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, mdname(mddev)); mirror->recovery_disabled = mddev->recovery_disabled; + } else { + error_disk = i; } put_buf(r10_bio); if (rb2)