md/raid5: Wait sync io to finish before changing group cnt
PATCH 1/1 md/raid5: Wait sync io to finish before changing group cnt
One customer reports a bug: raid5 is hung when changing thread cnt while resync is running. The stripes are all in conf->handle_list and new threads can't handle them.
Commit b39f35ebe86d ("md: don't quiesce in mddev_suspend()") removes pers->quiesce from mddev_suspend/resume. Before this patch, mddev_suspend needs to wait for all ios including sync io to finish. Now it's used to only wait normal io.
In this patch, it calls raid5_quiesce in raid5_store_group_thread_cnt directly to wait all sync requests to finish before changing the group cnt.
--- drivers/md/raid5.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/raid5.c +4 -0
@@ -7177,6 +7177,8 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len) err =mddev_suspend_and_lock (mddev);if (err)return err; +raid5_quiesce (mddev, true); + conf = mddev->private;if (!conf) err = -ENODEV ;
@@ -7198,6 +7200,8 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len)kfree (old_groups); } } + +raid5_quiesce (mddev, false);mddev_unlock_and_resume (mddev);return err ?: len;
Signature · 1 line
2.32.0 (Apple Git-132)
Quoted 13 lines · Xiao Ni
One customer reports a bug: raid5 is hung when changing thread cnt while resync is running. The stripes are all in
conf->handle_listand new threads can't handle them.Commit
b39f35ebe86d("md: don't quiesce inmddev_suspend()") removespers->quiescefrom mddev_suspend/resume. Before this patch,mddev_suspendneeds to wait for all ios including sync io to finish. Now it's used to only wait normal io.In this patch, it calls
raid5_quiesceinraid5_store_group_thread_cntdirectly to wait all sync requests to finish before changing the group cnt.
Quoted 6 lines
Fixes b39f35ebe86d ("md: don't quiesce in mddev_suspend()")Signed-off-by Xiao Ni <[email protected]>--- drivers/md/raid5.c | 4 ++++ 1 file changed, 4 insertions(+)
LGTM
Quoted 23 lines
drivers/md/raid5.c +4
-0@@ -7177,6 +7177,8 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len) err =mddev_suspend_and_lock (mddev);if (err)return err; +raid5_quiesce (mddev, true); + conf = mddev->private;if (!conf) err = -ENODEV ;@@ -7198,6 +7200,8 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len)kfree (old_groups); } } + +raid5_quiesce (mddev, false);mddev_unlock_and_resume (mddev);return err ?: len;
Quoted 15 lines · Yu Kuai
Quoted 13 lines · Xiao Ni
One customer reports a bug: raid5 is hung when changing thread cnt while resync is running. The stripes are all in
conf->handle_listand new threads can't handle them.Commit
b39f35ebe86d("md: don't quiesce inmddev_suspend()") removespers->quiescefrom mddev_suspend/resume. Before this patch,mddev_suspendneeds to wait for all ios including sync io to finish. Now it's used to only wait normal io.In this patch, it calls
raid5_quiesceinraid5_store_group_thread_cntdirectly to wait all sync requests to finish before changing the group cnt.
Quoted 8 lines
Quoted 6 lines
Fixes b39f35ebe86d ("md: don't quiesce in mddev_suspend()")Signed-off-by Xiao Ni <[email protected]>--- drivers/md/raid5.c | 4 ++++ 1 file changed, 4 insertions(+)LGTM
Reviewed-by Yu Kuai <[email protected]>
Applied to md-6.13. Thanks for the fix!
Song