Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30097282rwd; Thu, 6 Jul 2023 00:26:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+rN+Rnz9IIm77v4Cu15j4HWZQSJJtGEwU27asL2eRDGWqQo8V8/0dtqcA4KZIYOPr9Ljb X-Received: by 2002:a05:6358:98a2:b0:134:c530:c2fa with SMTP id q34-20020a05635898a200b00134c530c2famr1107492rwa.30.1688628387247; Thu, 06 Jul 2023 00:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688628387; cv=none; d=google.com; s=arc-20160816; b=nEV1HUNrvU/QC04rkWTRs2KTLUuQsTOtHZ8+EjI2/eP/0D1cs+8xz0vkGuIUfEsuyu tUqOhL3BTlsmqB0NFTe7f7p0F+d1Z9TOLWyw6Ux5zKbqoIKA+XRZuEMXD22YsSctwVKy ubiTiMyl5x5gxeXOehMpsRx9ZYJtFQUkCEYPOMpoNa4HmRNRV2Ga9CQ+vcc95EuCfc5X sWHaGI9Z+zpstR+d0sXWu1y0iFHJeJszl6ceUD1JLdqHdi+/A3Vm6lJoqMc93yu56OPD lZwil540uxOkDldjAdVzYhjdFwUvgR3/IufhRqwseNEyc3Iw8NdmbcdT9BvReq6wBvyj YcYA== 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=650HeZBvsSWEESSg6iJRoeXT6QuKfJ9urowCqbHHRsA=; fh=8SRQxsru4ZyU8ltobz7jrssUFGgn+ZlQ5Br9i4TubRA=; b=Wr+gLGobOjVIVgkRwJp70q2W1UfKWOarEZZmlDzfqQARqg9M65nS0nQFOd+Ay96sD8 AGZ021L9aqDSyjvtt70Ux6I76xZNoqmPUuEBwZUdvUUFmyW/Ohhooh1uOjFmDFBNEai+ 2QfEViqpWqSqoun9C0O8pwLGp0q8VPfV7ivjaewXnG9NXgCyNFUnr/0n7CtDnHgo6V34 IydOwp13KsivJNA41E3PMQgB2Cu1Vvdj3JipBcx6px8m49AFNuqgfXx0E2g9Vatnd2X8 /n2KTe43DV/AjSj4mrx5KLi5eHBSN+KOxDD0kfK+xIISAzpegvhUBbE+D9U5wzVrFYKm oDJA== 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 b13-20020a65578d000000b0054ff67daa8csi890737pgr.751.2023.07.06.00.26.14; Thu, 06 Jul 2023 00:26: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; 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 S233512AbjGFHRu (ORCPT + 99 others); Thu, 6 Jul 2023 03:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbjGFHRt (ORCPT ); Thu, 6 Jul 2023 03:17:49 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 893A9DA; Thu, 6 Jul 2023 00:17:47 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QxSXl5yYTz4f3nTX; Thu, 6 Jul 2023 15:17:43 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCnD7OVaqZkZ3pMNQ--.43123S6; Thu, 06 Jul 2023 15:17:44 +0800 (CST) From: Yu Kuai To: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org, heinzm@redhat.com, neilb@suse.de, jbrassow@redhat.com Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 2/3] md/dm-raid: cleanup multiple equivalent goto tags from raid_ctr() Date: Thu, 6 Jul 2023 15:16:21 +0800 Message-Id: <20230706071622.563073-3-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230706071622.563073-1-yukuai1@huaweicloud.com> References: <20230706071622.563073-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCnD7OVaqZkZ3pMNQ--.43123S6 X-Coremail-Antispam: 1UD129KBjvJXoW7WrWUXr4xCw47Ww43KF1rWFg_yoW8Kw4kpF 4aga9Ikr18X39IgFW0gr4kWF15Ka4FgryUKrs3CFWrZa1Y9r4agw18GFyUXryUJFyrJa4D AF1UAr4DWay0kaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUHbyAUUUUU = X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,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: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Kuai There are four equivalent goto tags in raid_ctr(), clean them up to use just one, there are no functional change and prepare to fix that md_stop() is not protected. Signed-off-by: Yu Kuai --- drivers/md/dm-raid.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 4c819d5f93fd..33742f5e7ee5 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3251,8 +3251,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) r = md_start(&rs->md); if (r) { ti->error = "Failed to start raid array"; - mddev_unlock(&rs->md); - goto bad_md_start; + goto bad_unlock; } /* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */ @@ -3260,8 +3259,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode); if (r) { ti->error = "Failed to set raid4/5/6 journal mode"; - mddev_unlock(&rs->md); - goto bad_journal_mode_set; + goto bad_unlock; } } @@ -3271,19 +3269,15 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) /* Try to adjust the raid4/5/6 stripe cache size to the stripe size */ if (rs_is_raid456(rs)) { r = rs_set_raid456_stripe_cache(rs); - if (r) { - mddev_unlock(&rs->md); - goto bad_stripe_cache; - } + if (r) + goto bad_unlock; } /* Now do an early reshape check */ if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) { r = rs_check_reshape(rs); - if (r) { - mddev_unlock(&rs->md); - goto bad_check_reshape; - } + if (r) + goto bad_unlock; /* Restore new, ctr requested layout to perform check */ rs_config_restore(rs, &rs_layout); @@ -3292,8 +3286,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) r = rs->md.pers->check_reshape(&rs->md); if (r) { ti->error = "Reshape check failed"; - mddev_unlock(&rs->md); - goto bad_check_reshape; + goto bad_unlock; } } } @@ -3304,10 +3297,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) mddev_unlock(&rs->md); return 0; -bad_md_start: -bad_journal_mode_set: -bad_stripe_cache: -bad_check_reshape: +bad_unlock: + mddev_unlock(&rs->md); md_stop(&rs->md); bad: raid_set_free(rs); -- 2.39.2