]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame - multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch
Move all packages to root.
[people/amarx/ipfire-3.x.git] / multipath-tools / patches / 0019-RHBZ-554598-fix-multipath-locking.patch
CommitLineData
dc01aad8
SS
1---
2 libmultipath/configure.c | 16 +++++++++++++++-
3 1 file changed, 15 insertions(+), 1 deletion(-)
4
5Index: multipath-tools/libmultipath/configure.c
6===================================================================
7--- multipath-tools.orig/libmultipath/configure.c
8+++ multipath-tools/libmultipath/configure.c
9@@ -284,6 +284,7 @@ lock_multipath (struct multipath * mpp,
10 struct pathgroup * pgp;
11 struct path * pp;
12 int i, j;
13+ int x, y;
14
15 if (!mpp || !mpp->pg)
16 return 0;
17@@ -294,12 +295,25 @@ lock_multipath (struct multipath * mpp,
18 vector_foreach_slot(pgp->paths, pp, j) {
19 if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) &&
20 errno == EWOULDBLOCK)
21- return 1;
22+ goto fail;
23 else if (!lock)
24 flock(pp->fd, LOCK_UN);
25 }
26 }
27 return 0;
28+fail:
29+ vector_foreach_slot (mpp->pg, pgp, x) {
30+ if (x > i)
31+ return 1;
32+ if (!pgp->paths)
33+ continue;
34+ vector_foreach_slot(pgp->paths, pp, y) {
35+ if (x == i && y > j)
36+ return 1;
37+ flock(pp->fd, LOCK_UN);
38+ }
39+ }
40+ return 1;
41 }
42
43 /*