Commit c6d3ab9e authored by Jens Axboe's avatar Jens Axboe

Merge tag 'md-fixes-20231207-1' of...

Merge tag 'md-fixes-20231207-1' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into block-6.7

Pull MD fix from Song:

"This change from Yu Kuai fixes a bug reported in
 https://bugzilla.kernel.org/show_bug.cgi?id=218200"

* tag 'md-fixes-20231207-1' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md: split MD_RECOVERY_NEEDED out of mddev_resume
parents 22b9a896 b3911334
...@@ -490,7 +490,7 @@ int mddev_suspend(struct mddev *mddev, bool interruptible) ...@@ -490,7 +490,7 @@ int mddev_suspend(struct mddev *mddev, bool interruptible)
} }
EXPORT_SYMBOL_GPL(mddev_suspend); EXPORT_SYMBOL_GPL(mddev_suspend);
void mddev_resume(struct mddev *mddev) static void __mddev_resume(struct mddev *mddev, bool recovery_needed)
{ {
lockdep_assert_not_held(&mddev->reconfig_mutex); lockdep_assert_not_held(&mddev->reconfig_mutex);
...@@ -507,12 +507,18 @@ void mddev_resume(struct mddev *mddev) ...@@ -507,12 +507,18 @@ void mddev_resume(struct mddev *mddev)
percpu_ref_resurrect(&mddev->active_io); percpu_ref_resurrect(&mddev->active_io);
wake_up(&mddev->sb_wait); wake_up(&mddev->sb_wait);
if (recovery_needed)
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->thread);
md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
mutex_unlock(&mddev->suspend_mutex); mutex_unlock(&mddev->suspend_mutex);
} }
void mddev_resume(struct mddev *mddev)
{
return __mddev_resume(mddev, true);
}
EXPORT_SYMBOL_GPL(mddev_resume); EXPORT_SYMBOL_GPL(mddev_resume);
/* /*
...@@ -9389,7 +9395,15 @@ static void md_start_sync(struct work_struct *ws) ...@@ -9389,7 +9395,15 @@ static void md_start_sync(struct work_struct *ws)
goto not_running; goto not_running;
} }
suspend ? mddev_unlock_and_resume(mddev) : mddev_unlock(mddev); mddev_unlock(mddev);
/*
* md_start_sync was triggered by MD_RECOVERY_NEEDED, so we should
* not set it again. Otherwise, we may cause issue like this one:
* https://bugzilla.kernel.org/show_bug.cgi?id=218200
* Therefore, use __mddev_resume(mddev, false).
*/
if (suspend)
__mddev_resume(mddev, false);
md_wakeup_thread(mddev->sync_thread); md_wakeup_thread(mddev->sync_thread);
sysfs_notify_dirent_safe(mddev->sysfs_action); sysfs_notify_dirent_safe(mddev->sysfs_action);
md_new_event(); md_new_event();
...@@ -9401,7 +9415,15 @@ static void md_start_sync(struct work_struct *ws) ...@@ -9401,7 +9415,15 @@ static void md_start_sync(struct work_struct *ws)
clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery); clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
suspend ? mddev_unlock_and_resume(mddev) : mddev_unlock(mddev); mddev_unlock(mddev);
/*
* md_start_sync was triggered by MD_RECOVERY_NEEDED, so we should
* not set it again. Otherwise, we may cause issue like this one:
* https://bugzilla.kernel.org/show_bug.cgi?id=218200
* Therefore, use __mddev_resume(mddev, false).
*/
if (suspend)
__mddev_resume(mddev, false);
wake_up(&resync_wait); wake_up(&resync_wait);
if (test_and_clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery) && if (test_and_clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment