From f8cecf7a7767753e24280343b4a8acccba06cc60 Mon Sep 17 00:00:00 2001 From: Li Nan Date: Sat, 3 Jun 2023 14:50:34 +0800 Subject: [PATCH] md/raid10: fix softlockup in raid10_unplug hulk inclusion category: bugfix bugzilla: 188628, https://gitee.com/openeuler/kernel/issues/I6WKDR CVE: NA -------------------------------- There is no limit to the number of io for raid10 plug, whitch may result in excessive memory usage and potential softlockup when a large number of io are submitted at once. There is no good way to fix it now, just add schedule point to prevent softlockup. Fixes: 57c67df48866 ("md/raid10: submit IO from originating thread instead of md thread.") Signed-off-by: Li Nan Reviewed-by: Yu Kuai Reviewed-by: Hou Tao --- drivers/md/raid10.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 04869394e345..ba136d4c6b89 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -896,6 +896,7 @@ static void flush_pending_writes(struct r10conf *conf) else submit_bio_noacct(bio); bio = next; + cond_resched(); } blk_finish_plug(&plug); } else @@ -1089,6 +1090,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule) else submit_bio_noacct(bio); bio = next; + cond_resched(); } kfree(plug); } -- GitLab