]>
Commit | Line | Data |
---|---|---|
b7ca0ba0 SL |
1 | From d34dc105da100e9ea5d00a6b7a2f6d4cd1302f9a Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Wed, 20 Mar 2024 18:43:11 +0100 | |
4 | Subject: dm snapshot: fix lockup in dm_exception_table_exit | |
5 | ||
6 | From: Mikulas Patocka <mpatocka@redhat.com> | |
7 | ||
8 | [ Upstream commit 6e7132ed3c07bd8a6ce3db4bb307ef2852b322dc ] | |
9 | ||
10 | There was reported lockup when we exit a snapshot with many exceptions. | |
11 | Fix this by adding "cond_resched" to the loop that frees the exceptions. | |
12 | ||
13 | Reported-by: John Pittman <jpittman@redhat.com> | |
14 | Cc: stable@vger.kernel.org | |
15 | Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> | |
16 | Signed-off-by: Mike Snitzer <snitzer@kernel.org> | |
17 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
18 | --- | |
19 | drivers/md/dm-snap.c | 4 +++- | |
20 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
21 | ||
22 | diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c | |
23 | index 41735a25d50aa..de73fe79640fd 100644 | |
24 | --- a/drivers/md/dm-snap.c | |
25 | +++ b/drivers/md/dm-snap.c | |
26 | @@ -685,8 +685,10 @@ static void dm_exception_table_exit(struct dm_exception_table *et, | |
27 | for (i = 0; i < size; i++) { | |
28 | slot = et->table + i; | |
29 | ||
30 | - hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) | |
31 | + hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) { | |
32 | kmem_cache_free(mem, ex); | |
33 | + cond_resched(); | |
34 | + } | |
35 | } | |
36 | ||
37 | vfree(et->table); | |
38 | -- | |
39 | 2.43.0 | |
40 |