Commit 7d5fff89 authored by Yu Kuai's avatar Yu Kuai Committed by Mike Snitzer

dm raid: protect md_stop() with 'reconfig_mutex'

__md_stop_writes() and __md_stop() will modify many fields that are
protected by 'reconfig_mutex', and all the callers will grab
'reconfig_mutex' except for md_stop().

Also, update md_stop() to make certain 'reconfig_mutex' is held using
lockdep_assert_held().

Fixes: 9d09e663 ("dm: raid456 basic support")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent e74c874e
......@@ -3298,8 +3298,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return 0;
bad_unlock:
mddev_unlock(&rs->md);
md_stop(&rs->md);
mddev_unlock(&rs->md);
bad:
raid_set_free(rs);
......@@ -3310,7 +3310,9 @@ static void raid_dtr(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
mddev_lock_nointr(&rs->md);
md_stop(&rs->md);
mddev_unlock(&rs->md);
raid_set_free(rs);
}
......
......@@ -6247,6 +6247,8 @@ static void __md_stop(struct mddev *mddev)
void md_stop(struct mddev *mddev)
{
lockdep_assert_held(&mddev->reconfig_mutex);
/* stop the array and free an attached data structures.
* This is called from dm-raid
*/
......
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