Blob Blame History Raw
From: Mike Snitzer <snitzer@kernel.org>
Date: Thu, 16 Feb 2023 12:10:05 -0500
Subject: [PATCH] dm: add cond_resched() to dm_wq_requeue_work()
References: bsc#1012628
Patch-mainline: 6.2.3
Git-commit: f77692d65d54665d81815349cc727baa85e8b71d

commit f77692d65d54665d81815349cc727baa85e8b71d upstream.

Otherwise the while() loop in dm_wq_requeue_work() can result in a
"dead loop" on systems that have preemption disabled. This is
particularly problematic on single cpu systems.

Fixes: 8b211aaccb915 ("dm: add two stage requeue mechanism")
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 3aea215a..60566293 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1007,6 +1007,7 @@ static void dm_wq_requeue_work(struct work_struct *work)
 		io->next = NULL;
 		__dm_io_complete(io, false);
 		io = next;
+		cond_resched();
 	}
 }
 
-- 
2.35.3