~cyphermox/ubuntu/trusty/multipath-tools/usb+local

« back to all changes in this revision

Viewing changes to debian/patches/0014-Fix-race-condition-in-stop_waiter_thread.patch

  • Committer: Package Import Robot
  • Author(s): Rafael David Tinoco
  • Date: 2014-08-07 16:15:25 UTC
  • Revision ID: package-import@ubuntu.com-20140807161525-whfb9ggygzcwuawa
Tags: 0.4.9-3ubuntu7.1
* Added 0011-libmultipath-update-waiter-handling.patch (LP: #1354114)
* Added 0012-Race-condition-when-calling-stop_waiter_thread.patch (LP: #1354114)
* Added 0013-multipath-clean-up-code-for-stopping-the-waiter-thre.patch (LP: #1354114)
* Added 0014-Fix-race-condition-in-stop_waiter_thread.patch (LP: #1354114)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: [PATCH 4/4] Fix race condition in stop_waiter_thread()
 
2
 
 
3
The signal handler might run before we had a chance to
 
4
set the 'waiter' context to '0', so better do it previously.
 
5
 
 
6
Signed-off-by: Hannes Reinecke <hare@suse.de>
 
7
 
 
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
 
12
 
 
13
---
 
14
 libmultipath/waiter.c |    5 ++++-
 
15
 1 file changed, 4 insertions(+), 1 deletion(-)
 
16
 
 
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)
 
22
 
 
23
 void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
 
24
 {
 
25
+       pthread_t thread;
 
26
+
 
27
        if (mpp->waiter == (pthread_t)0) {
 
28
                condlog(3, "%s: event checker thread already stopped",
 
29
                        mpp->alias);
 
30
@@ -52,8 +54,9 @@ void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
 
31
        }
 
32
        condlog(2, "%s: stop event checker thread (%lu)", mpp->alias,
 
33
                mpp->waiter);
 
34
-       pthread_cancel(mpp->waiter);
 
35
+       thread = mpp->waiter;
 
36
        mpp->waiter = (pthread_t)0;
 
37
+       pthread_cancel(thread);
 
38
 }
 
39
 
 
40
 /*
 
41
-- 
 
42
1.7.9.5
 
43