Skip to content

Commit

Permalink
md: Avoid sync_action sync->idle transition deadlock
Browse files Browse the repository at this point in the history
When a mdraid recovery/check is paused by writing "idle" to sync_action,
sometimes the system deadlocks [1].

The latest fix proposed by the maintainer is not valid [2].

Use the fix we proposed ourself [3] until upstream comes up with
something better.

[1]: https://lore.kernel.org/linux-raid/5ed54ffc-ce82-bf66-4eff-390cb23bc1ac@molgen.mpg.de/T/#m28b00fdf4749f55c83282b20485c554ec199a108
[2]: https://lore.kernel.org/linux-raid/7fdb9726-4b1f-e04c-2451-f47139ddc05b@cloud.ionos.com/T/#m78c755f6b43a9c06d2c85b9d4e49c19657ddb155
[3]: https://lore.kernel.org/linux-raid/5ed54ffc-ce82-bf66-4eff-390cb23bc1ac@molgen.mpg.de/T/#m8a1d4c25781b8c3032ef38e3ffec425714515a16
  • Loading branch information
donald committed Feb 25, 2022
1 parent 358ac01 commit accd3a9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4858,12 +4858,14 @@ action_store(struct mddev *mddev, const char *page, size_t len)
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) &&
mddev_lock(mddev) == 0) {
set_bit(MD_ALLOW_SB_UPDATE, &mddev->flags);
if (work_pending(&mddev->del_work))
flush_workqueue(md_misc_wq);
if (mddev->sync_thread) {
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
md_reap_sync_thread(mddev);
}
clear_bit(MD_ALLOW_SB_UPDATE, &mddev->flags);
mddev_unlock(mddev);
}
} else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
Expand Down

0 comments on commit accd3a9

Please sign in to comment.