diff options
author | Guoqing Jiang <guoqing.jiang@cloud.ionos.com> | 2021-02-13 01:49:59 +0100 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2022-05-22 23:07:21 -0700 |
commit | 8b48ec23cc51a4e7c8dbaef5f34ebe67e1a80934 (patch) | |
tree | 8de244d677ec5e71cea81588e8b3e388a410cf22 /drivers/md/dm-raid.c | |
parent | 537b9f2bf60f4bbd8ab89cea16aaab70f0c1560d (diff) | |
download | linux-8b48ec23cc51a4e7c8dbaef5f34ebe67e1a80934.tar.gz linux-8b48ec23cc51a4e7c8dbaef5f34ebe67e1a80934.tar.bz2 linux-8b48ec23cc51a4e7c8dbaef5f34ebe67e1a80934.zip |
md: don't unregister sync_thread with reconfig_mutex held
Unregister sync_thread doesn't need to hold reconfig_mutex since it
doesn't reconfigure array.
And it could cause deadlock problem for raid5 as follows:
1. process A tried to reap sync thread with reconfig_mutex held after echo
idle to sync_action.
2. raid5 sync thread was blocked if there were too many active stripes.
3. SB_CHANGE_PENDING was set (because of write IO comes from upper layer)
which causes the number of active stripes can't be decreased.
4. SB_CHANGE_PENDING can't be cleared since md_check_recovery was not able
to hold reconfig_mutex.
More details in the link:
https://lore.kernel.org/linux-raid/5ed54ffc-ce82-bf66-4eff-390cb23bc1ac@molgen.mpg.de/T/#t
And add one parameter to md_reap_sync_thread since it could be called by
dm-raid which doesn't hold reconfig_mutex.
Reported-and-tested-by: Donald Buczek <buczek@molgen.mpg.de>
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r-- | drivers/md/dm-raid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 9526ccbedafb..5e41fbae3f6b 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3725,7 +3725,7 @@ static int raid_message(struct dm_target *ti, unsigned int argc, char **argv, if (!strcasecmp(argv[0], "idle") || !strcasecmp(argv[0], "frozen")) { if (mddev->sync_thread) { set_bit(MD_RECOVERY_INTR, &mddev->recovery); - md_reap_sync_thread(mddev); + md_reap_sync_thread(mddev, false); } } else if (decipher_sync_action(mddev, mddev->recovery) != st_idle) return -EBUSY; |