Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 9dbd1aa3a81c ("dm raid: add reshaping support to the target")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Yu Kuai and committed by
Mike Snitzer
bae30287 d4a3806b

+7 -2
+7 -2
drivers/md/dm-raid.c
··· 3271 3271 /* Try to adjust the raid4/5/6 stripe cache size to the stripe size */ 3272 3272 if (rs_is_raid456(rs)) { 3273 3273 r = rs_set_raid456_stripe_cache(rs); 3274 - if (r) 3274 + if (r) { 3275 + mddev_unlock(&rs->md); 3275 3276 goto bad_stripe_cache; 3277 + } 3276 3278 } 3277 3279 3278 3280 /* Now do an early reshape check */ 3279 3281 if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) { 3280 3282 r = rs_check_reshape(rs); 3281 - if (r) 3283 + if (r) { 3284 + mddev_unlock(&rs->md); 3282 3285 goto bad_check_reshape; 3286 + } 3283 3287 3284 3288 /* Restore new, ctr requested layout to perform check */ 3285 3289 rs_config_restore(rs, &rs_layout); ··· 3292 3288 r = rs->md.pers->check_reshape(&rs->md); 3293 3289 if (r) { 3294 3290 ti->error = "Reshape check failed"; 3291 + mddev_unlock(&rs->md); 3295 3292 goto bad_check_reshape; 3296 3293 } 3297 3294 }