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 <[email protected]>
Cc: [email protected]

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

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);


Reply via email to