|
|
50dc83 |
From ff8a74250209f4279f67dd89c3e57b2289a1b7d1 Mon Sep 17 00:00:00 2001
|
|
|
50dc83 |
From: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
50dc83 |
Date: Thu, 9 May 2019 11:07:18 +0200
|
|
|
50dc83 |
Subject: [PATCH 144/169] cluster/ec: honor contention notifications for
|
|
|
50dc83 |
partially acquired locks
|
|
|
50dc83 |
|
|
|
50dc83 |
EC was ignoring lock contention notifications received while a lock was
|
|
|
50dc83 |
being acquired. When a lock is partially acquired (some bricks have
|
|
|
50dc83 |
granted the lock but some others not yet) we can receive notifications
|
|
|
50dc83 |
from acquired bricks, which should be honored, since we may not receive
|
|
|
50dc83 |
more notifications after that.
|
|
|
50dc83 |
|
|
|
50dc83 |
Since EC was ignoring them, once the lock was acquired, it was not
|
|
|
50dc83 |
released until the eager-lock timeout, causing unnecessary delays on
|
|
|
50dc83 |
other clients.
|
|
|
50dc83 |
|
|
|
50dc83 |
This fix takes into consideration the notifications received before
|
|
|
50dc83 |
having completed the full lock acquisition. After that, the lock will
|
|
|
50dc83 |
be releaed as soon as possible.
|
|
|
50dc83 |
|
|
|
50dc83 |
Upstream patch:
|
|
|
50dc83 |
> BUG: 1708156
|
|
|
50dc83 |
> Upstream patch link: https://review.gluster.org/c/glusterfs/+/22690
|
|
|
50dc83 |
> Change-Id: I2a306dbdb29fb557dcab7788a258bd75d826cc12
|
|
|
50dc83 |
> Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
50dc83 |
|
|
|
50dc83 |
Fixes: bz#1703455
|
|
|
50dc83 |
Change-Id: I2a306dbdb29fb557dcab7788a258bd75d826cc12
|
|
|
50dc83 |
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
50dc83 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/171525
|
|
|
50dc83 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
50dc83 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
50dc83 |
---
|
|
|
50dc83 |
...or-inodelk-contention-notify-on-partial-locks.t | 54 ++++++++++++++++++++++
|
|
|
50dc83 |
xlators/cluster/ec/src/ec-common.c | 2 +-
|
|
|
50dc83 |
2 files changed, 55 insertions(+), 1 deletion(-)
|
|
|
50dc83 |
create mode 100644 tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t
|
|
|
50dc83 |
|
|
|
50dc83 |
diff --git a/tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t b/tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t
|
|
|
50dc83 |
new file mode 100644
|
|
|
50dc83 |
index 0000000..67fdb18
|
|
|
50dc83 |
--- /dev/null
|
|
|
50dc83 |
+++ b/tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t
|
|
|
50dc83 |
@@ -0,0 +1,54 @@
|
|
|
50dc83 |
+#!/bin/bash
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+. $(dirname $0)/../../include.rc
|
|
|
50dc83 |
+. $(dirname $0)/../../volume.rc
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+function do_ls() {
|
|
|
50dc83 |
+ local dir="${1}"
|
|
|
50dc83 |
+ local i
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+ for i in {1..50}; do
|
|
|
50dc83 |
+ ls -l $M0/${dir} >/dev/null &
|
|
|
50dc83 |
+ ls -l $M1/${dir} >/dev/null &
|
|
|
50dc83 |
+ ls -l $M2/${dir} >/dev/null &
|
|
|
50dc83 |
+ ls -l $M3/${dir} >/dev/null &
|
|
|
50dc83 |
+ done
|
|
|
50dc83 |
+ wait
|
|
|
50dc83 |
+}
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+function measure_time() {
|
|
|
50dc83 |
+ {
|
|
|
50dc83 |
+ LC_ALL=C
|
|
|
50dc83 |
+ time -p "${@}"
|
|
|
50dc83 |
+ } 2>&1 | awk '/^real/ { print $2 * 1000 }'
|
|
|
50dc83 |
+}
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+cleanup
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+TEST glusterd
|
|
|
50dc83 |
+TEST pidof glusterd
|
|
|
50dc83 |
+TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+TEST $CLI volume set $V0 disperse.eager-lock on
|
|
|
50dc83 |
+TEST $CLI volume set $V0 disperse.other-eager-lock on
|
|
|
50dc83 |
+TEST $CLI volume set $V0 features.locks-notify-contention on
|
|
|
50dc83 |
+TEST $CLI volume set $V0 disperse.eager-lock-timeout 10
|
|
|
50dc83 |
+TEST $CLI volume set $V0 disperse.other-eager-lock-timeout 10
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+TEST $CLI volume start $V0
|
|
|
50dc83 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
50dc83 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M1
|
|
|
50dc83 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M2
|
|
|
50dc83 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M3
|
|
|
50dc83 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M0
|
|
|
50dc83 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M1
|
|
|
50dc83 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M2
|
|
|
50dc83 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M3
|
|
|
50dc83 |
+TEST mkdir $M0/dir
|
|
|
50dc83 |
+TEST touch $M0/dir/file.{1..10}
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+# Run multiple 'ls' concurrently from multiple clients so that they collide and
|
|
|
50dc83 |
+# cause partial locks.
|
|
|
50dc83 |
+TEST [[ $(measure_time do_ls dir) -lt 10000 ]]
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+cleanup
|
|
|
50dc83 |
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
|
|
|
50dc83 |
index b1ba5e9..e85aa8b 100644
|
|
|
50dc83 |
--- a/xlators/cluster/ec/src/ec-common.c
|
|
|
50dc83 |
+++ b/xlators/cluster/ec/src/ec-common.c
|
|
|
50dc83 |
@@ -2497,7 +2497,7 @@ ec_lock_release(ec_t *ec, inode_t *inode)
|
|
|
50dc83 |
goto done;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
lock = ctx->inode_lock;
|
|
|
50dc83 |
- if ((lock == NULL) || !lock->acquired || lock->release) {
|
|
|
50dc83 |
+ if ((lock == NULL) || lock->release) {
|
|
|
50dc83 |
goto done;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
--
|
|
|
50dc83 |
1.8.3.1
|
|
|
50dc83 |
|