diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-09-06 15:09:42 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-10-05 14:38:52 +0000 |
commit | 8610bafb07334f37f61cce423db4fe7b2a104722 (patch) | |
tree | f0bf9fb1f72f38a949c5a9cae6b956893bdb546b /xlators | |
parent | 50ef643281fd1797d9087ff7275c366d67773534 (diff) | |
download | glusterfs-8610bafb07334f37f61cce423db4fe7b2a104722.tar.gz glusterfs-8610bafb07334f37f61cce423db4fe7b2a104722.tar.xz glusterfs-8610bafb07334f37f61cce423db4fe7b2a104722.zip |
cluster/afr: Batch writes in same lock even when multiple fds are open
Problem:
When eager-lock is disabled because of multiple-fds opened and app
writes come on conflicting regions, the number of locks grows very
fast leading to all the CPU being spent just in locking and unlocking
by traversing huge queues in locks xlator for granting locks.
Fix:
Reduce the number of locks in transit by bundling the writes in the
same lock and disable delayed piggy-pack when we learn that multiple
fds are open on the file. This will reduce the size of queues in the
locks xlator. This also reduces the number of network calls like
inodelk/fxattrop.
Please note that this problem can still happen if eager-lock is
disabled as the writes will not be bundled in the same lock.
fixes bz#1635979
Change-Id: I8fd1cf229aed54ce5abd4e6226351a039924dd91
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 74fa6e51b9..0cd3373ff3 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -2306,9 +2306,6 @@ __need_previous_lock_unlocked (afr_local_t *local) { afr_lock_t *lock = NULL; - if (!local->transaction.eager_lock_on) - return _gf_true; - lock = &local->inode_ctx->lock[local->transaction.type]; if (!lock->acquired) return _gf_false; @@ -2325,10 +2322,8 @@ __afr_eager_lock_handle (afr_local_t *local, gf_boolean_t *take_lock, afr_local_t *owner_local = NULL; xlator_t *this = local->transaction.frame->this; - if (local->fd && !afr_are_multiple_fds_opened (local, this)) { - local->transaction.eager_lock_on = _gf_true; - afr_set_lk_owner (local->transaction.frame, this, local->inode); - } + local->transaction.eager_lock_on = _gf_true; + afr_set_lk_owner (local->transaction.frame, this, local->inode); lock = &local->inode_ctx->lock[local->transaction.type]; if (__need_previous_lock_unlocked (local)) { @@ -2347,8 +2342,6 @@ __afr_eager_lock_handle (afr_local_t *local, gf_boolean_t *take_lock, lock->delay_timer = NULL; } } - if (!local->transaction.eager_lock_on) - goto out; } if (lock->release) { |