Skip to content

Commit e74c874

Browse files
YuKuai-huaweiMike Snitzer
authored andcommitted
dm raid: clean up four equivalent goto tags in raid_ctr()
There are four equivalent goto tags in raid_ctr(), clean them up to use just one. There is no functional change and this is preparation to fix raid_ctr()'s unprotected md_stop(). Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent bae3028 commit e74c874

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

drivers/md/dm-raid.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,17 +3251,15 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32513251
r = md_start(&rs->md);
32523252
if (r) {
32533253
ti->error = "Failed to start raid array";
3254-
mddev_unlock(&rs->md);
3255-
goto bad_md_start;
3254+
goto bad_unlock;
32563255
}
32573256

32583257
/* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */
32593258
if (test_bit(__CTR_FLAG_JOURNAL_MODE, &rs->ctr_flags)) {
32603259
r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode);
32613260
if (r) {
32623261
ti->error = "Failed to set raid4/5/6 journal mode";
3263-
mddev_unlock(&rs->md);
3264-
goto bad_journal_mode_set;
3262+
goto bad_unlock;
32653263
}
32663264
}
32673265

@@ -3271,19 +3269,15 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32713269
/* Try to adjust the raid4/5/6 stripe cache size to the stripe size */
32723270
if (rs_is_raid456(rs)) {
32733271
r = rs_set_raid456_stripe_cache(rs);
3274-
if (r) {
3275-
mddev_unlock(&rs->md);
3276-
goto bad_stripe_cache;
3277-
}
3272+
if (r)
3273+
goto bad_unlock;
32783274
}
32793275

32803276
/* Now do an early reshape check */
32813277
if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
32823278
r = rs_check_reshape(rs);
3283-
if (r) {
3284-
mddev_unlock(&rs->md);
3285-
goto bad_check_reshape;
3286-
}
3279+
if (r)
3280+
goto bad_unlock;
32873281

32883282
/* Restore new, ctr requested layout to perform check */
32893283
rs_config_restore(rs, &rs_layout);
@@ -3292,8 +3286,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32923286
r = rs->md.pers->check_reshape(&rs->md);
32933287
if (r) {
32943288
ti->error = "Reshape check failed";
3295-
mddev_unlock(&rs->md);
3296-
goto bad_check_reshape;
3289+
goto bad_unlock;
32973290
}
32983291
}
32993292
}
@@ -3304,10 +3297,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
33043297
mddev_unlock(&rs->md);
33053298
return 0;
33063299

3307-
bad_md_start:
3308-
bad_journal_mode_set:
3309-
bad_stripe_cache:
3310-
bad_check_reshape:
3300+
bad_unlock:
3301+
mddev_unlock(&rs->md);
33113302
md_stop(&rs->md);
33123303
bad:
33133304
raid_set_free(rs);

0 commit comments

Comments
 (0)