a3470f
From ecbb79d192695e06345036aa4f24e0f029ce8b02 Mon Sep 17 00:00:00 2001
a3470f
From: Pranith Kumar K <pkarampu@redhat.com>
a3470f
Date: Fri, 17 Nov 2017 07:20:21 +0530
a3470f
Subject: [PATCH 234/236] ec: Use tiebreaker_inodelk where necessary
a3470f
a3470f
When there are big directories or files that need to be healed,
a3470f
other shds are stuck on getting lock on self-heal domain for these
a3470f
directories/files. If there is a tie-breaker logic, other shds
a3470f
can heal some other files/directories while 1 of the shds is healing
a3470f
the big file/directory.
a3470f
a3470f
Before this patch:
a3470f
96.67  4890.64 us 12.89 us 646115887.30us 340869 INODELK
a3470f
After this patch:
a3470f
40.76  42.35 us   15.09 us 6546.50us 438478 INODELK
a3470f
a3470f
 >Fixes gluster/glusterfs#354
a3470f
a3470f
Upstream-patch: https://review.gluster.org/18820
a3470f
BUG: 1562744
a3470f
Change-Id: Ia995b5576b44f770c064090705c78459e543cc64
a3470f
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/134280
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
a3470f
---
a3470f
 xlators/cluster/ec/src/ec-heal.c | 19 +++++++++++--------
a3470f
 1 file changed, 11 insertions(+), 8 deletions(-)
a3470f
a3470f
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
a3470f
index 8e02986..a1d3f3d 100644
a3470f
--- a/xlators/cluster/ec/src/ec-heal.c
a3470f
+++ b/xlators/cluster/ec/src/ec-heal.c
a3470f
@@ -1562,9 +1562,9 @@ ec_heal_entry (call_frame_t *frame, ec_t *ec, inode_t *inode,
a3470f
         sprintf (selfheal_domain, "%s:self-heal", ec->xl->name);
a3470f
         ec_mask_to_char_array (ec->xl_up, up_subvols, ec->nodes);
a3470f
         /*If other processes are already doing the heal, don't block*/
a3470f
-        ret = cluster_inodelk (ec->xl_list, up_subvols, ec->nodes, replies,
a3470f
-                               locked_on, frame, ec->xl, selfheal_domain, inode,
a3470f
-                               0, 0);
a3470f
+        ret = cluster_tiebreaker_inodelk (ec->xl_list, up_subvols, ec->nodes,
a3470f
+                                          replies, locked_on, frame, ec->xl,
a3470f
+                                          selfheal_domain, inode, 0, 0);
a3470f
         {
a3470f
                 if (ret <= ec->fragments) {
a3470f
                         gf_msg_debug (ec->xl->name, 0, "%s: Skipping heal "
a3470f
@@ -2400,9 +2400,10 @@ ec_heal_data (call_frame_t *frame, ec_t *ec, gf_boolean_t block, inode_t *inode,
a3470f
                                        locked_on, frame, ec->xl,
a3470f
                                        selfheal_domain, inode, 0, 0);
a3470f
         } else {
a3470f
-                ret = cluster_tryinodelk (ec->xl_list, output, ec->nodes,
a3470f
-                                          replies, locked_on, frame, ec->xl,
a3470f
-                                          selfheal_domain, inode, 0, 0);
a3470f
+                ret = cluster_tiebreaker_inodelk (ec->xl_list, output,
a3470f
+                                                  ec->nodes, replies, locked_on,
a3470f
+                                                  frame, ec->xl,
a3470f
+                                                  selfheal_domain, inode, 0, 0);
a3470f
         }
a3470f
         {
a3470f
                 if (ret <= ec->fragments) {
a3470f
@@ -2453,8 +2454,10 @@ ec_heal_do (xlator_t *this, void *data, loc_t *loc, int32_t partial)
a3470f
 
a3470f
         /* If it is heal request from getxattr, complete the heal and then
a3470f
          * unwind, if it is ec_heal with NULL as frame then no need to block
a3470f
-         * the heal as the caller doesn't care about its completion*/
a3470f
-        if (fop->req_frame)
a3470f
+         * the heal as the caller doesn't care about its completion. In case
a3470f
+         * of heald whichever gets tiebreaking inodelk will take care of the
a3470f
+         * heal, so no need to block*/
a3470f
+        if (fop->req_frame && !ec->shd.iamshd)
a3470f
                 blocking = _gf_true;
a3470f
 
a3470f
         frame = create_frame (this, this->ctx->pool);
a3470f
-- 
a3470f
1.8.3.1
a3470f