Skip to contentSkip to conversation

dm snapshot: add cond_resched to dm_exception_table_exit

PATCH New Mikulas Patocka 1 participant 1 message Mar 20, 2024 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

PATCH 1/1 dm snapshot: add cond_resched to dm_exception_table_exit

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.

---
 drivers/md/dm-snap.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-snap.c +3 -1
Index: linux-2.6/drivers/md/dm-snap.c
===================================================================
@@ -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);