1 |
pacho 12/07/08 11:47:14 |
2 |
|
3 |
Added: libgamin-0.1.10-deadlock.patch |
4 |
Log: |
5 |
Fix deadlock, bug #420353 by Michael Boone. |
6 |
|
7 |
(Portage version: 2.1.11.5/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-libs/libgamin/files/libgamin-0.1.10-deadlock.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libgamin/files/libgamin-0.1.10-deadlock.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libgamin/files/libgamin-0.1.10-deadlock.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: libgamin-0.1.10-deadlock.patch |
16 |
=================================================================== |
17 |
From cc14440eface093548cb3bc7814da11d9a99d283 Mon Sep 17 00:00:00 2001 |
18 |
From: Anssi Hannula <anssi@××××××.org> |
19 |
Date: Wed, 4 Jan 2012 00:23:55 +0200 |
20 |
Subject: [PATCH] fix possible server deadlock in ih_sub_cancel |
21 |
|
22 |
ih_sub_foreach() calls ih_sub_cancel() while inotify_lock is locked. |
23 |
However, ih_sub_cancel() locks it again, and locking GMutex recursively |
24 |
causes undefined behaviour. |
25 |
|
26 |
Fix that by removing locking from ih_sub_cancel() as ih_sub_foreach() |
27 |
is its only user. Also make the function static so that it won't |
28 |
accidentally get used by other files without locking (inotify-helper.h |
29 |
is an internal server header). |
30 |
|
31 |
This should fix the intermittent deadlocks I've been experiencing |
32 |
causing KDE applications to no longer start, and probably also |
33 |
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542361 |
34 |
--- |
35 |
server/inotify-helper.c | 7 ++----- |
36 |
server/inotify-helper.h | 1 - |
37 |
2 files changed, 2 insertions(+), 6 deletions(-) |
38 |
|
39 |
diff --git a/server/inotify-helper.c b/server/inotify-helper.c |
40 |
index d77203e..0789fa4 100644 |
41 |
--- a/server/inotify-helper.c |
42 |
+++ b/server/inotify-helper.c |
43 |
@@ -123,13 +123,11 @@ ih_sub_add (ih_sub_t * sub) |
44 |
|
45 |
/** |
46 |
* Cancels a subscription which was being monitored. |
47 |
+ * inotify_lock must be held when calling. |
48 |
*/ |
49 |
-gboolean |
50 |
+static gboolean |
51 |
ih_sub_cancel (ih_sub_t * sub) |
52 |
{ |
53 |
- G_LOCK(inotify_lock); |
54 |
- |
55 |
- |
56 |
if (!sub->cancelled) |
57 |
{ |
58 |
IH_W("cancelling %s\n", sub->pathname); |
59 |
@@ -140,7 +138,6 @@ ih_sub_cancel (ih_sub_t * sub) |
60 |
sub_list = g_list_remove (sub_list, sub); |
61 |
} |
62 |
|
63 |
- G_UNLOCK(inotify_lock); |
64 |
return TRUE; |
65 |
} |
66 |
|
67 |
diff --git a/server/inotify-helper.h b/server/inotify-helper.h |
68 |
index 5d3b6d0..d36b5fd 100644 |
69 |
--- a/server/inotify-helper.h |
70 |
+++ b/server/inotify-helper.h |
71 |
@@ -34,7 +34,6 @@ gboolean ih_startup (event_callback_t ecb, |
72 |
found_callback_t fcb); |
73 |
gboolean ih_running (void); |
74 |
gboolean ih_sub_add (ih_sub_t *sub); |
75 |
-gboolean ih_sub_cancel (ih_sub_t *sub); |
76 |
|
77 |
/* Return FALSE from 'f' if the subscription should be cancelled */ |
78 |
void ih_sub_foreach (void *callerdata, gboolean (*f)(ih_sub_t *sub, void *callerdata)); |
79 |
-- |
80 |
1.7.7.2 |