dm: add cond_resched() to dm_wq_work()
authorPingfan Liu <piliu@redhat.com>
Wed, 15 Feb 2023 11:23:40 +0000 (19:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:40:06 +0000 (09:40 +0100)
commit 0ca44fcef241768fd25ee763b3d203b9852f269b upstream.

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

Cc: stable@vger.kernel.org
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm.c

index d0806d0f3c7300c5c5df5f582f458a9ccb37d876..0bd2185d5194e641b690e2dc9e8157cf683c15ad 100644 (file)
@@ -2305,6 +2305,7 @@ static void dm_wq_work(struct work_struct *work)
                        break;
 
                submit_bio_noacct(bio);
+               cond_resched();
        }
 }