Commit e74c874e authored by Yu Kuai's avatar Yu Kuai Committed by Mike Snitzer

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: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent bae30287
...@@ -3251,8 +3251,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -3251,8 +3251,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
r = md_start(&rs->md); r = md_start(&rs->md);
if (r) { if (r) {
ti->error = "Failed to start raid array"; ti->error = "Failed to start raid array";
mddev_unlock(&rs->md); goto bad_unlock;
goto bad_md_start;
} }
/* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */ /* 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) ...@@ -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); r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode);
if (r) { if (r) {
ti->error = "Failed to set raid4/5/6 journal mode"; ti->error = "Failed to set raid4/5/6 journal mode";
mddev_unlock(&rs->md); goto bad_unlock;
goto bad_journal_mode_set;
} }
} }
...@@ -3271,19 +3269,15 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -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 */ /* Try to adjust the raid4/5/6 stripe cache size to the stripe size */
if (rs_is_raid456(rs)) { if (rs_is_raid456(rs)) {
r = rs_set_raid456_stripe_cache(rs); r = rs_set_raid456_stripe_cache(rs);
if (r) { if (r)
mddev_unlock(&rs->md); goto bad_unlock;
goto bad_stripe_cache;
}
} }
/* Now do an early reshape check */ /* Now do an early reshape check */
if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) { if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
r = rs_check_reshape(rs); r = rs_check_reshape(rs);
if (r) { if (r)
mddev_unlock(&rs->md); goto bad_unlock;
goto bad_check_reshape;
}
/* Restore new, ctr requested layout to perform check */ /* Restore new, ctr requested layout to perform check */
rs_config_restore(rs, &rs_layout); rs_config_restore(rs, &rs_layout);
...@@ -3292,8 +3286,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -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); r = rs->md.pers->check_reshape(&rs->md);
if (r) { if (r) {
ti->error = "Reshape check failed"; ti->error = "Reshape check failed";
mddev_unlock(&rs->md); goto bad_unlock;
goto bad_check_reshape;
} }
} }
} }
...@@ -3304,10 +3297,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -3304,10 +3297,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
mddev_unlock(&rs->md); mddev_unlock(&rs->md);
return 0; return 0;
bad_md_start: bad_unlock:
bad_journal_mode_set: mddev_unlock(&rs->md);
bad_stripe_cache:
bad_check_reshape:
md_stop(&rs->md); md_stop(&rs->md);
bad: bad:
raid_set_free(rs); raid_set_free(rs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment