summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2022-06-08 19:27:56 +0300
committerJens Axboe <axboe@kernel.dk>2022-08-03 02:14:40 +0300
commit9973f0fa7d20269fe6fefe6333997fb5914449c1 (patch)
tree3762e33e0b00587cfeeba48f208937d558658e1d /drivers/md/md.c
parentb368856aab02c8fcaabb809aad401b2cf96504f2 (diff)
downloadlinux-9973f0fa7d20269fe6fefe6333997fb5914449c1.tar.xz
md: Notify sysfs sync_completed in md_reap_sync_thread()
The mdadm test 07layouts randomly produces a kernel hung task deadlock. The deadlock is caused by the suspend_lo/suspend_hi files being set by the mdadm background process during reshape and not being cleared because the process hangs. (Leaving aside the issue of the fragility of freezing kernel tasks by buggy userspace processes...) When the background mdadm process hangs it, is waiting (without a timeout) on a change to the sync_completed file signalling that the reshape has completed. The process is woken up a couple times when the reshape finishes but it is woken up before MD_RECOVERY_RUNNING is cleared so sync_completed_show() reports 0 instead of "none". To fix this, notify the sysfs file in md_reap_sync_thread() after MD_RECOVERY_RUNNING has been cleared. This wakes up mdadm and causes it to continue and write to suspend_lo/suspend_hi to allow IO to continue. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e6c67834c73f..621cf85962da 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9472,6 +9472,7 @@ void md_reap_sync_thread(struct mddev *mddev)
wake_up(&resync_wait);
/* flag recovery needed just to double check */
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+ sysfs_notify_dirent_safe(mddev->sysfs_completed);
sysfs_notify_dirent_safe(mddev->sysfs_action);
md_new_event();
if (mddev->event_work.func)