Skip to contentSkip to conversation

Patch "dm-raid: fix lockdep waring in "pers->hot_add_disk"" has been added to the 4.19-stable tree

PATCH Sasha Levin 1 participant 1 message Mar 27, 2024 Device mapper

lore
Share & tools
lore

Sasha Levin

author Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    dm-raid: fix lockdep waring in "pers->hot_add_disk"

to the 4.19-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dm-raid-fix-lockdep-waring-in-pers-hot_add_disk.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

commit 1b3818962a987bdc835b4603c3028f209b754aa5

Author: Yu Kuai <[email protected]>
Date:   Tue Mar 5 15:23:06 2024 +0800

dm-raid: fix lockdep waring in "pers->hot_add_disk"

[ Upstream commit 95009ae904b1e9dca8db6f649f2d7c18a6e42c75 ]

The lockdep assert is added by commit a448af25becf ("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 9092c02d9435 ("DM RAID: Add ability to restore transiently failed devices on resume")
Fixes a448af25becf ("md/raid10: remove rcu protection to access rdev from conf")
drivers/md/dm-raid.c +2 -0
index 1759134fce824..2a8746f9c6d87 100644
@@ -4023,7 +4023,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)) {