Skip to content

Commit 8111162

Browse files
YuKuai-huaweismb49
authored andcommitted
dm-raid: fix lockdep waring in "pers->hot_add_disk"
BugLink: https://bugs.launchpad.net/bugs/2065435 [ Upstream commit 95009ae ] The lockdep assert is added by commit a448af2 ("md/raid10: remove rcu protection to access rdev from conf") in print_conf(). And I didn't notice that dm-raid is calling "pers->hot_add_disk" without holding 'reconfig_mutex'. "pers->hot_add_disk" read and write many fields that is protected by 'reconfig_mutex', and raid_resume() already grab the lock in other contex. Hence fix this problem by protecting "pers->host_add_disk" with the lock. Fixes: 9092c02 ("DM RAID: Add ability to restore transiently failed devices on resume") Fixes: a448af2 ("md/raid10: remove rcu protection to access rdev from conf") Cc: [email protected] # v6.7+ Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Xiao Ni <[email protected]> Acked-by: Mike Snitzer <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent d563f4c commit 8111162

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/dm-raid.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4049,7 +4049,9 @@ static void raid_resume(struct dm_target *ti)
40494049
* Take this opportunity to check whether any failed
40504050
* devices are reachable again.
40514051
*/
4052+
mddev_lock_nointr(mddev);
40524053
attempt_restore_of_faulty_devices(rs);
4054+
mddev_unlock(mddev);
40534055
}
40544056

40554057
if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {

0 commit comments

Comments
 (0)