1
Description: [PATCH 4/4] Fix race condition in stop_waiter_thread()
3
The signal handler might run before we had a chance to
4
set the 'waiter' context to '0', so better do it previously.
6
Signed-off-by: Hannes Reinecke <hare@suse.de>
8
Origin: upstream, commit: af4fd6d
9
Author: Hannes Reinecke <hare@suse.de>
10
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1354114
11
Last-Update: 2014-08-08
14
libmultipath/waiter.c | 5 ++++-
15
1 file changed, 4 insertions(+), 1 deletion(-)
17
diff --git a/libmultipath/waiter.c b/libmultipath/waiter.c
18
index 2323b68..05050f5 100644
19
--- a/libmultipath/waiter.c
20
+++ b/libmultipath/waiter.c
21
@@ -45,6 +45,8 @@ void free_waiter (void *data)
23
void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
27
if (mpp->waiter == (pthread_t)0) {
28
condlog(3, "%s: event checker thread already stopped",
30
@@ -52,8 +54,9 @@ void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
32
condlog(2, "%s: stop event checker thread (%lu)", mpp->alias,
34
- pthread_cancel(mpp->waiter);
35
+ thread = mpp->waiter;
36
mpp->waiter = (pthread_t)0;
37
+ pthread_cancel(thread);