提交 6315095f 编写于 作者: Y Yu Kuai 提交者: Jialin Zhang

md: use interruptible apis in idle/frozen_sync_thread

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6OMCC
CVE: NA

--------------------------------

Before refactoring idle and frozen from action_store, interruptible apis
is used so that hungtask warning won't be triggered if it takes too long
to finish indle/frozen sync_thread. This patch do the same.
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
上级 4cea8d59
...@@ -4892,11 +4892,14 @@ static void idle_sync_thread(struct mddev *mddev) ...@@ -4892,11 +4892,14 @@ static void idle_sync_thread(struct mddev *mddev)
{ {
int sync_seq = atomic_read(&mddev->sync_seq); int sync_seq = atomic_read(&mddev->sync_seq);
mutex_lock(&mddev->sync_mutex); if (mutex_lock_interruptible(&mddev->sync_mutex))
return;
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
stop_sync_thread(mddev); stop_sync_thread(mddev);
wait_event(resync_wait, sync_seq != atomic_read(&mddev->sync_seq) || wait_event_interruptible(resync_wait,
sync_seq != atomic_read(&mddev->sync_seq) ||
!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)); !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery));
mutex_unlock(&mddev->sync_mutex); mutex_unlock(&mddev->sync_mutex);
...@@ -4904,11 +4907,13 @@ static void idle_sync_thread(struct mddev *mddev) ...@@ -4904,11 +4907,13 @@ static void idle_sync_thread(struct mddev *mddev)
static void frozen_sync_thread(struct mddev *mddev) static void frozen_sync_thread(struct mddev *mddev)
{ {
mutex_lock(&mddev->sync_mutex); if (mutex_lock_interruptible(&mddev->sync_mutex))
return;
set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
stop_sync_thread(mddev); stop_sync_thread(mddev);
wait_event(resync_wait, mddev->sync_thread == NULL && wait_event_interruptible(resync_wait, mddev->sync_thread == NULL &&
!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)); !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery));
mutex_unlock(&mddev->sync_mutex); mutex_unlock(&mddev->sync_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册