]> git.baikalelectronics.ru Git - kernel.git/commit
md/md-bitmap: hold 'reconfig_mutex' in backlog_store()
authorYu Kuai <yukuai3@huawei.com>
Thu, 6 Jul 2023 08:37:27 +0000 (16:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:41 +0000 (09:42 +0200)
commitf9b9c6b0d45153144a1d7710d7b34fcb386c1576
tree9af7e5bb53d7f15ddbb27bc63bb537eb163b9051
parente970bc3828b70cad08d7b11206508c6c921b11f5
md/md-bitmap: hold 'reconfig_mutex' in backlog_store()

[ Upstream commit 44abfa6a95df425c0660d56043020b67e6d93ab8 ]

Several reasons why 'reconfig_mutex' should be held:

1) rdev_for_each() is not safe to be called without the lock, because
   rdev can be removed concurrently.
2) mddev_destroy_serial_pool() and mddev_create_serial_pool() should not
   be called concurrently.
3) mddev_suspend() from mddev_destroy/create_serial_pool() should be
   protected by the lock.

Fixes: 10c92fca636e ("md-bitmap: create and destroy wb_info_pool with the change of backlog")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20230706083727.608914-3-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md-bitmap.c