Skip to content

Commit bae3028

Browse files
YuKuai-huaweiMike Snitzer
authored andcommitted
dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths
In the error paths 'bad_stripe_cache' and 'bad_check_reshape', 'reconfig_mutex' is still held after raid_ctr() returns. Fixes: 9dbd1aa ("dm raid: add reshaping support to the target") Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent d4a3806 commit bae3028

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/md/dm-raid.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,15 +3271,19 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32713271
/* Try to adjust the raid4/5/6 stripe cache size to the stripe size */
32723272
if (rs_is_raid456(rs)) {
32733273
r = rs_set_raid456_stripe_cache(rs);
3274-
if (r)
3274+
if (r) {
3275+
mddev_unlock(&rs->md);
32753276
goto bad_stripe_cache;
3277+
}
32763278
}
32773279

32783280
/* Now do an early reshape check */
32793281
if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
32803282
r = rs_check_reshape(rs);
3281-
if (r)
3283+
if (r) {
3284+
mddev_unlock(&rs->md);
32823285
goto bad_check_reshape;
3286+
}
32833287

32843288
/* Restore new, ctr requested layout to perform check */
32853289
rs_config_restore(rs, &rs_layout);
@@ -3288,6 +3292,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32883292
r = rs->md.pers->check_reshape(&rs->md);
32893293
if (r) {
32903294
ti->error = "Reshape check failed";
3295+
mddev_unlock(&rs->md);
32913296
goto bad_check_reshape;
32923297
}
32933298
}

0 commit comments

Comments
 (0)