diff mbox series

dm snapshot: add cond_resched to dm_exception_table_exit

Message ID fab7e-7fb7-4d28-ac54-2141bbc6bfde@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm snapshot: add cond_resched to dm_exception_table_exit | expand

Commit Message

Mikulas Patocka March 20, 2024, 5:43 p.m. UTC
There was reported lockup when we exit a snapshot with many exceptions.
Fix this by adding "cond_resched" to the loop that frees the exceptions.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/md/dm-snap.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

Index: linux-2.6/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-snap.c	2024-03-06 17:54:03.000000000 +0100
+++ linux-2.6/drivers/md/dm-snap.c	2024-03-20 18:38:20.000000000 +0100
@@ -684,8 +684,10 @@  static void dm_exception_table_exit(stru
 	for (i = 0; i < size; i++) {
 		slot = et->table + i;
 
-		hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list)
+		hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) {
 			kmem_cache_free(mem, ex);
+			cond_resched();
+		}
 	}
 
 	kvfree(et->table);