Skip to content

Commit

Permalink
dm-raid: fix lockdep waring in "pers->hot_add_disk"
Browse files Browse the repository at this point in the history
[ 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]>
  • Loading branch information
Yu Kuai authored and gregkh committed Apr 10, 2024
1 parent 125de15 commit a3b6004
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -4049,7 +4049,9 @@ static void raid_resume(struct dm_target *ti)
* Take this opportunity to check whether any failed
* devices are reachable again.
*/
mddev_lock_nointr(mddev);
attempt_restore_of_faulty_devices(rs);
mddev_unlock(mddev);
}

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

0 comments on commit a3b6004

Please sign in to comment.