glusterfs/0380-cluster-afr-Batch-writes-in-same-lock-even-when-mult.patch
Sunil Kumar Acharya be071b020b autobuild v3.12.2-19
Resolves: bz#1459709 bz#1610743 bz#1618221 bz#1619627 bz#1622649
Resolves: bz#1623749 bz#1623874 bz#1624444 bz#1625622 bz#1626780
Resolves: bz#1627098 bz#1627617 bz#1627639 bz#1630688
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
2018-09-21 23:36:36 -04:00

74 lines
3.0 KiB
Diff

From 8f270fceed4c03ab4405ae65e7e9ce7fce9e008c Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Thu, 6 Sep 2018 15:09:42 +0530
Subject: [PATCH 380/385] 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.
Upstream-patch: https://review.gluster.org/c/glusterfs/+/21107
BUG: 1630688
Change-Id: I8fd1cf229aed54ce5abd4e6226351a039924dd91
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/150700
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/cluster/afr/src/afr-transaction.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 3f55070..85b00a8 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -2241,9 +2241,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;
@@ -2260,10 +2257,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)) {
@@ -2282,8 +2277,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) {
--
1.8.3.1