diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2019-05-09 11:07:18 +0200 |
---|---|---|
committer | Hari Gowtham <hgowtham@redhat.com> | 2019-06-28 16:37:08 +0530 |
commit | 257fee6312513498ee70765b9f343d5df77b1fce (patch) | |
tree | 202ae7cf7464c8ecdc03cc4858d3a12ca0ddbd09 | |
parent | 5355f5a18146183a8e27872ebee501acad7b5eb0 (diff) |
cluster/ec: honor contention notifications for partially acquired locks
EC was ignoring lock contention notifications received while a lock was
being acquired. When a lock is partially acquired (some bricks have
granted the lock but some others not yet) we can receive notifications
from acquired bricks, which should be honored, since we may not receive
more notifications after that.
Since EC was ignoring them, once the lock was acquired, it was not
released until the eager-lock timeout, causing unnecessary delays on
other clients.
This fix takes into consideration the notifications received before
having completed the full lock acquisition. After that, the lock will
be releaed as soon as possible.
Backport of:
> BUG: bz#1708156
> Change-Id: I2a306dbdb29fb557dcab7788a258bd75d826cc12
> Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Fixes: bz#1717282
Change-Id: I2a306dbdb29fb557dcab7788a258bd75d826cc12
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
-rw-r--r-- | tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t | 54 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 2 |
2 files changed, 55 insertions, 1 deletions
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 new file mode 100644 index 00000000000..67fdb184b46 --- /dev/null +++ b/tests/bugs/ec/bug-1708156-honor-inodelk-contention-notify-on-partial-locks.t @@ -0,0 +1,54 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +function do_ls() { + local dir="${1}" + local i + + for i in {1..50}; do + ls -l $M0/${dir} >/dev/null & + ls -l $M1/${dir} >/dev/null & + ls -l $M2/${dir} >/dev/null & + ls -l $M3/${dir} >/dev/null & + done + wait +} + +function measure_time() { + { + LC_ALL=C + time -p "${@}" + } 2>&1 | awk '/^real/ { print $2 * 1000 }' +} + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} + +TEST $CLI volume set $V0 disperse.eager-lock on +TEST $CLI volume set $V0 disperse.other-eager-lock on +TEST $CLI volume set $V0 features.locks-notify-contention on +TEST $CLI volume set $V0 disperse.eager-lock-timeout 10 +TEST $CLI volume set $V0 disperse.other-eager-lock-timeout 10 + +TEST $CLI volume start $V0 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M1 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M2 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M3 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M1 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M2 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 $M3 +TEST mkdir $M0/dir +TEST touch $M0/dir/file.{1..10} + +# Run multiple 'ls' concurrently from multiple clients so that they collide and +# cause partial locks. +TEST [[ $(measure_time do_ls dir) -lt 10000 ]] + +cleanup diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 0eee0a3363f..32ddabee0d0 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -2452,7 +2452,7 @@ ec_lock_release(ec_t *ec, inode_t *inode) goto done; } lock = ctx->inode_lock; - if ((lock == NULL) || !lock->acquired || lock->release) { + if ((lock == NULL) || lock->release) { goto done; } |