Skip to content

Commit 95009ae

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
dm-raid: fix lockdep waring in "pers->hot_add_disk"
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]
1 parent 41425f9 commit 95009ae

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
@@ -4091,7 +4091,9 @@ static void raid_resume(struct dm_target *ti)
40914091
* Take this opportunity to check whether any failed
40924092
* devices are reachable again.
40934093
*/
4094+
mddev_lock_nointr(mddev);
40944095
attempt_restore_of_faulty_devices(rs);
4096+
mddev_unlock(mddev);
40954097
}
40964098

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

0 commit comments

Comments
 (0)