diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0083-zcache-fix-deadlock-condition.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0083-zcache-fix-deadlock-condition.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0083-zcache-fix-deadlock-condition.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0083-zcache-fix-deadlock-condition.patch new file mode 100644 index 00000000..c73b80a1 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0083-zcache-fix-deadlock-condition.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | From 5c97f5b2d4924961479e862e8fe516ba217551b3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dan Magenheimer <dan.magenheimer@oracle.com> | ||
3 | Date: Wed, 25 Jan 2012 14:32:51 -0800 | ||
4 | Subject: [PATCH 83/87] zcache: fix deadlock condition | ||
5 | |||
6 | commit 9256a4789be3dae37d00924c03546ba7958ea5a3 upstream. | ||
7 | |||
8 | I discovered this deadlock condition awhile ago working on RAMster | ||
9 | but it affects zcache as well. The list spinlock must be | ||
10 | locked prior to the page spinlock and released after. As | ||
11 | a result, the page copy must also be done while the locks are held. | ||
12 | |||
13 | Applies to 3.2. Konrad, please push (via GregKH?)... | ||
14 | this is definitely a bug fix so need not be pushed during | ||
15 | a -rc0 window. | ||
16 | |||
17 | Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> | ||
18 | Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
20 | --- | ||
21 | drivers/staging/zcache/zcache-main.c | 7 +++---- | ||
22 | 1 files changed, 3 insertions(+), 4 deletions(-) | ||
23 | |||
24 | diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c | ||
25 | index d3a8e67..f5e469d 100644 | ||
26 | --- a/drivers/staging/zcache/zcache-main.c | ||
27 | +++ b/drivers/staging/zcache/zcache-main.c | ||
28 | @@ -358,8 +358,8 @@ static struct zbud_hdr *zbud_create(uint16_t client_id, uint16_t pool_id, | ||
29 | if (unlikely(zbpg == NULL)) | ||
30 | goto out; | ||
31 | /* ok, have a page, now compress the data before taking locks */ | ||
32 | - spin_lock(&zbpg->lock); | ||
33 | spin_lock(&zbud_budlists_spinlock); | ||
34 | + spin_lock(&zbpg->lock); | ||
35 | list_add_tail(&zbpg->bud_list, &zbud_unbuddied[nchunks].list); | ||
36 | zbud_unbuddied[nchunks].count++; | ||
37 | zh = &zbpg->buddy[0]; | ||
38 | @@ -389,12 +389,11 @@ init_zh: | ||
39 | zh->oid = *oid; | ||
40 | zh->pool_id = pool_id; | ||
41 | zh->client_id = client_id; | ||
42 | - /* can wait to copy the data until the list locks are dropped */ | ||
43 | - spin_unlock(&zbud_budlists_spinlock); | ||
44 | - | ||
45 | to = zbud_data(zh, size); | ||
46 | memcpy(to, cdata, size); | ||
47 | spin_unlock(&zbpg->lock); | ||
48 | + spin_unlock(&zbud_budlists_spinlock); | ||
49 | + | ||
50 | zbud_cumul_chunk_counts[nchunks]++; | ||
51 | atomic_inc(&zcache_zbud_curr_zpages); | ||
52 | zcache_zbud_cumul_zpages++; | ||
53 | -- | ||
54 | 1.7.7.4 | ||
55 | |||