87c3ef
From 54d4ea44fec96560aad9c41f7e4f5aad164ffb8b Mon Sep 17 00:00:00 2001
87c3ef
From: Ravishankar N <ravishankar@redhat.com>
87c3ef
Date: Fri, 5 Jun 2020 14:14:15 +0530
87c3ef
Subject: [PATCH 424/449] afr: make heal info lockless
87c3ef
87c3ef
Changes in locks xlator:
87c3ef
Added support for per-domain inodelk count requests.
87c3ef
Caller needs to set GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS key in the
87c3ef
dict and then set each key with name
87c3ef
'GLUSTERFS_INODELK_DOM_PREFIX:<domain name>'.
87c3ef
In the response dict, the xlator will send the per domain count as
87c3ef
values for each of these keys.
87c3ef
87c3ef
Changes in AFR:
87c3ef
Replaced afr_selfheal_locked_inspect() with afr_lockless_inspect(). Logic has
87c3ef
been added to make the latter behave same as the former, thus not
87c3ef
breaking the current heal info output behaviour.
87c3ef
87c3ef
> Upstream patch: https://review.gluster.org/#/c/glusterfs/+/23771/
87c3ef
> fixes: bz#1774011
87c3ef
> Change-Id: Ie9e83c162aa77f44a39c2ba7115de558120ada4d
87c3ef
87c3ef
BUG: 1721355
87c3ef
Change-Id: I8ed4b504880b19e00068312efd90cd0706787404
87c3ef
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
87c3ef
Reviewed-on: https://code.engineering.redhat.com/gerrit/202490
87c3ef
Tested-by: RHGS Build Bot <nigelb@redhat.com>
87c3ef
Reviewed-by: Karthik Subrahmanya <ksubrahm@redhat.com>
87c3ef
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
87c3ef
---
87c3ef
 heal/src/glfs-heal.c                           |  17 +-
87c3ef
 libglusterfs/src/glusterfs/glusterfs.h         |   2 +
87c3ef
 xlators/cluster/afr/src/afr-common.c           | 367 +++++++++++--------------
87c3ef
 xlators/cluster/afr/src/afr-self-heal-common.c |  43 ++-
87c3ef
 xlators/cluster/afr/src/afr-self-heal.h        |   3 +-
87c3ef
 xlators/features/locks/src/common.h            |   4 +
87c3ef
 xlators/features/locks/src/locks.h             |   8 +
87c3ef
 xlators/features/locks/src/posix.c             | 117 +++++++-
87c3ef
 8 files changed, 338 insertions(+), 223 deletions(-)
87c3ef
87c3ef
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
87c3ef
index 125b12c..5af9e31 100644
87c3ef
--- a/heal/src/glfs-heal.c
87c3ef
+++ b/heal/src/glfs-heal.c
87c3ef
@@ -775,7 +775,8 @@ static int
87c3ef
 glfsh_process_entries(xlator_t *xl, fd_t *fd, gf_dirent_t *entries,
87c3ef
                       uint64_t *offset, num_entries_t *num_entries,
87c3ef
                       print_status glfsh_print_status,
87c3ef
-                      gf_boolean_t ignore_dirty, glfsh_fail_mode_t mode)
87c3ef
+                      gf_boolean_t ignore_dirty, glfsh_fail_mode_t mode,
87c3ef
+                      dict_t *xattr_req)
87c3ef
 {
87c3ef
     gf_dirent_t *entry = NULL;
87c3ef
     gf_dirent_t *tmp = NULL;
87c3ef
@@ -807,7 +808,7 @@ glfsh_process_entries(xlator_t *xl, fd_t *fd, gf_dirent_t *entries,
87c3ef
 
87c3ef
         gf_uuid_parse(entry->d_name, gfid);
87c3ef
         gf_uuid_copy(loc.gfid, gfid);
87c3ef
-        ret = syncop_getxattr(this, &loc, &dict, GF_HEAL_INFO, NULL, NULL);
87c3ef
+        ret = syncop_getxattr(this, &loc, &dict, GF_HEAL_INFO, xattr_req, NULL);
87c3ef
         if (ret) {
87c3ef
             if ((mode != GLFSH_MODE_CONTINUE_ON_ERROR) && (ret == -ENOTCONN))
87c3ef
                 goto out;
87c3ef
@@ -876,19 +877,19 @@ glfsh_crawl_directory(glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
87c3ef
         if (heal_op == GF_SHD_OP_INDEX_SUMMARY) {
87c3ef
             ret = glfsh_process_entries(readdir_xl, fd, &entries, &offset,
87c3ef
                                         num_entries, glfsh_print_heal_status,
87c3ef
-                                        ignore, mode);
87c3ef
+                                        ignore, mode, xattr_req);
87c3ef
             if (ret < 0)
87c3ef
                 goto out;
87c3ef
         } else if (heal_op == GF_SHD_OP_SPLIT_BRAIN_FILES) {
87c3ef
             ret = glfsh_process_entries(readdir_xl, fd, &entries, &offset,
87c3ef
                                         num_entries, glfsh_print_spb_status,
87c3ef
-                                        ignore, mode);
87c3ef
+                                        ignore, mode, xattr_req);
87c3ef
             if (ret < 0)
87c3ef
                 goto out;
87c3ef
         } else if (heal_op == GF_SHD_OP_HEAL_SUMMARY) {
87c3ef
             ret = glfsh_process_entries(readdir_xl, fd, &entries, &offset,
87c3ef
                                         num_entries, glfsh_print_summary_status,
87c3ef
-                                        ignore, mode);
87c3ef
+                                        ignore, mode, xattr_req);
87c3ef
             if (ret < 0)
87c3ef
                 goto out;
87c3ef
         } else if (heal_op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) {
87c3ef
@@ -897,7 +898,7 @@ glfsh_crawl_directory(glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
87c3ef
         } else if (heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE) {
87c3ef
             ret = glfsh_process_entries(readdir_xl, fd, &entries, &offset,
87c3ef
                                         num_entries, glfsh_heal_status_boolean,
87c3ef
-                                        ignore, mode);
87c3ef
+                                        ignore, mode, xattr_req);
87c3ef
             if (ret < 0)
87c3ef
                 goto out;
87c3ef
         }
87c3ef
@@ -951,6 +952,10 @@ glfsh_print_pending_heals_type(glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
87c3ef
     int32_t op_errno = 0;
87c3ef
     gf_boolean_t ignore = _gf_false;
87c3ef
 
87c3ef
+    ret = dict_set_str(xattr_req, "index-vgfid", vgfid);
87c3ef
+    if (ret)
87c3ef
+        return ret;
87c3ef
+
87c3ef
     if (!strcmp(vgfid, GF_XATTROP_DIRTY_GFID))
87c3ef
         ignore = _gf_true;
87c3ef
 
87c3ef
diff --git a/libglusterfs/src/glusterfs/glusterfs.h b/libglusterfs/src/glusterfs/glusterfs.h
87c3ef
index 3b594c0..177a020 100644
87c3ef
--- a/libglusterfs/src/glusterfs/glusterfs.h
87c3ef
+++ b/libglusterfs/src/glusterfs/glusterfs.h
87c3ef
@@ -217,6 +217,8 @@ enum gf_internal_fop_indicator {
87c3ef
 #define GLUSTERFS_POSIXLK_COUNT "glusterfs.posixlk-count"
87c3ef
 #define GLUSTERFS_PARENT_ENTRYLK "glusterfs.parent-entrylk"
87c3ef
 #define GLUSTERFS_INODELK_DOM_COUNT "glusterfs.inodelk-dom-count"
87c3ef
+#define GLUSTERFS_INODELK_DOM_PREFIX "glusterfs.inodelk-dom-prefix"
87c3ef
+#define GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS "glusterfs.multi-dom-lk-cnt-req"
87c3ef
 #define GFID_TO_PATH_KEY "glusterfs.gfid2path"
87c3ef
 #define GF_XATTR_STIME_PATTERN "trusted.glusterfs.*.stime"
87c3ef
 #define GF_XATTR_XTIME_PATTERN "trusted.glusterfs.*.xtime"
87c3ef
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
87c3ef
index 59710aa..c355ec5 100644
87c3ef
--- a/xlators/cluster/afr/src/afr-common.c
87c3ef
+++ b/xlators/cluster/afr/src/afr-common.c
87c3ef
@@ -5908,259 +5908,218 @@ out:
87c3ef
     return _gf_true;
87c3ef
 }
87c3ef
 
87c3ef
-int
87c3ef
-afr_selfheal_locked_metadata_inspect(call_frame_t *frame, xlator_t *this,
87c3ef
-                                     inode_t *inode, gf_boolean_t *msh,
87c3ef
-                                     unsigned char *pending)
87c3ef
+static dict_t *
87c3ef
+afr_set_heal_info(char *status)
87c3ef
 {
87c3ef
+    dict_t *dict = NULL;
87c3ef
     int ret = -1;
87c3ef
-    unsigned char *locked_on = NULL;
87c3ef
-    unsigned char *sources = NULL;
87c3ef
-    unsigned char *sinks = NULL;
87c3ef
-    unsigned char *healed_sinks = NULL;
87c3ef
-    unsigned char *undid_pending = NULL;
87c3ef
-    struct afr_reply *locked_replies = NULL;
87c3ef
-
87c3ef
-    afr_private_t *priv = this->private;
87c3ef
 
87c3ef
-    locked_on = alloca0(priv->child_count);
87c3ef
-    sources = alloca0(priv->child_count);
87c3ef
-    sinks = alloca0(priv->child_count);
87c3ef
-    healed_sinks = alloca0(priv->child_count);
87c3ef
-    undid_pending = alloca0(priv->child_count);
87c3ef
+    dict = dict_new();
87c3ef
+    if (!dict) {
87c3ef
+        ret = -ENOMEM;
87c3ef
+        goto out;
87c3ef
+    }
87c3ef
 
87c3ef
-    locked_replies = alloca0(sizeof(*locked_replies) * priv->child_count);
87c3ef
+    ret = dict_set_dynstr_sizen(dict, "heal-info", status);
87c3ef
+    if (ret)
87c3ef
+        gf_msg("", GF_LOG_WARNING, -ret, AFR_MSG_DICT_SET_FAILED,
87c3ef
+               "Failed to set heal-info key to "
87c3ef
+               "%s",
87c3ef
+               status);
87c3ef
+out:
87c3ef
+    /* Any error other than EINVAL, dict_set_dynstr frees status */
87c3ef
+    if (ret == -ENOMEM || ret == -EINVAL) {
87c3ef
+        GF_FREE(status);
87c3ef
+    }
87c3ef
 
87c3ef
-    ret = afr_selfheal_inodelk(frame, this, inode, this->name, LLONG_MAX - 1, 0,
87c3ef
-                               locked_on);
87c3ef
-    {
87c3ef
-        if (ret == 0) {
87c3ef
-            /* Not a single lock */
87c3ef
-            ret = -afr_final_errno(frame->local, priv);
87c3ef
-            if (ret == 0)
87c3ef
-                ret = -ENOTCONN; /* all invalid responses */
87c3ef
-            goto out;
87c3ef
-        }
87c3ef
-        ret = __afr_selfheal_metadata_prepare(
87c3ef
-            frame, this, inode, locked_on, sources, sinks, healed_sinks,
87c3ef
-            undid_pending, locked_replies, pending);
87c3ef
-        *msh = afr_decide_heal_info(priv, sources, ret);
87c3ef
+    if (ret && dict) {
87c3ef
+        dict_unref(dict);
87c3ef
+        dict = NULL;
87c3ef
     }
87c3ef
-    afr_selfheal_uninodelk(frame, this, inode, this->name, LLONG_MAX - 1, 0,
87c3ef
-                           locked_on);
87c3ef
-out:
87c3ef
-    if (locked_replies)
87c3ef
-        afr_replies_wipe(locked_replies, priv->child_count);
87c3ef
-    return ret;
87c3ef
+    return dict;
87c3ef
 }
87c3ef
 
87c3ef
-int
87c3ef
-afr_selfheal_locked_data_inspect(call_frame_t *frame, xlator_t *this, fd_t *fd,
87c3ef
-                                 gf_boolean_t *dsh, unsigned char *pflag)
87c3ef
+static gf_boolean_t
87c3ef
+afr_is_dirty_count_non_unary_for_txn(xlator_t *this, struct afr_reply *replies,
87c3ef
+                                     afr_transaction_type type)
87c3ef
 {
87c3ef
-    int ret = -1;
87c3ef
-    unsigned char *data_lock = NULL;
87c3ef
-    unsigned char *sources = NULL;
87c3ef
-    unsigned char *sinks = NULL;
87c3ef
-    unsigned char *healed_sinks = NULL;
87c3ef
-    unsigned char *undid_pending = NULL;
87c3ef
-    afr_private_t *priv = NULL;
87c3ef
-    struct afr_reply *locked_replies = NULL;
87c3ef
-    inode_t *inode = fd->inode;
87c3ef
+    afr_private_t *priv = this->private;
87c3ef
+    int *dirty = alloca0(priv->child_count * sizeof(int));
87c3ef
+    int i = 0;
87c3ef
 
87c3ef
-    priv = this->private;
87c3ef
-    data_lock = alloca0(priv->child_count);
87c3ef
-    sources = alloca0(priv->child_count);
87c3ef
-    sinks = alloca0(priv->child_count);
87c3ef
-    healed_sinks = alloca0(priv->child_count);
87c3ef
-    undid_pending = alloca0(priv->child_count);
87c3ef
+    afr_selfheal_extract_xattr(this, replies, type, dirty, NULL);
87c3ef
+    for (i = 0; i < priv->child_count; i++) {
87c3ef
+        if (dirty[i] > 1)
87c3ef
+            return _gf_true;
87c3ef
+    }
87c3ef
 
87c3ef
-    locked_replies = alloca0(sizeof(*locked_replies) * priv->child_count);
87c3ef
+    return _gf_false;
87c3ef
+}
87c3ef
 
87c3ef
-    ret = afr_selfheal_inodelk(frame, this, inode, this->name, 0, 0, data_lock);
87c3ef
-    {
87c3ef
-        if (ret == 0) {
87c3ef
-            ret = -afr_final_errno(frame->local, priv);
87c3ef
-            if (ret == 0)
87c3ef
-                ret = -ENOTCONN; /* all invalid responses */
87c3ef
-            goto out;
87c3ef
-        }
87c3ef
-        ret = __afr_selfheal_data_prepare(frame, this, inode, data_lock,
87c3ef
-                                          sources, sinks, healed_sinks,
87c3ef
-                                          undid_pending, locked_replies, pflag);
87c3ef
-        *dsh = afr_decide_heal_info(priv, sources, ret);
87c3ef
+static gf_boolean_t
87c3ef
+afr_is_dirty_count_non_unary(xlator_t *this, struct afr_reply *replies,
87c3ef
+                             ia_type_t ia_type)
87c3ef
+{
87c3ef
+    gf_boolean_t data_chk = _gf_false;
87c3ef
+    gf_boolean_t mdata_chk = _gf_false;
87c3ef
+    gf_boolean_t entry_chk = _gf_false;
87c3ef
+
87c3ef
+    switch (ia_type) {
87c3ef
+        case IA_IFDIR:
87c3ef
+            mdata_chk = _gf_true;
87c3ef
+            entry_chk = _gf_true;
87c3ef
+            break;
87c3ef
+        case IA_IFREG:
87c3ef
+            mdata_chk = _gf_true;
87c3ef
+            data_chk = _gf_true;
87c3ef
+            break;
87c3ef
+        default:
87c3ef
+            /*IA_IFBLK, IA_IFCHR, IA_IFLNK, IA_IFIFO, IA_IFSOCK*/
87c3ef
+            mdata_chk = _gf_true;
87c3ef
+            break;
87c3ef
     }
87c3ef
-    afr_selfheal_uninodelk(frame, this, inode, this->name, 0, 0, data_lock);
87c3ef
-out:
87c3ef
-    if (locked_replies)
87c3ef
-        afr_replies_wipe(locked_replies, priv->child_count);
87c3ef
-    return ret;
87c3ef
+
87c3ef
+    if (data_chk && afr_is_dirty_count_non_unary_for_txn(
87c3ef
+                        this, replies, AFR_DATA_TRANSACTION)) {
87c3ef
+        return _gf_true;
87c3ef
+    } else if (mdata_chk && afr_is_dirty_count_non_unary_for_txn(
87c3ef
+                                this, replies, AFR_METADATA_TRANSACTION)) {
87c3ef
+        return _gf_true;
87c3ef
+    } else if (entry_chk && afr_is_dirty_count_non_unary_for_txn(
87c3ef
+                                this, replies, AFR_ENTRY_TRANSACTION)) {
87c3ef
+        return _gf_true;
87c3ef
+    }
87c3ef
+
87c3ef
+    return _gf_false;
87c3ef
 }
87c3ef
 
87c3ef
-int
87c3ef
-afr_selfheal_locked_entry_inspect(call_frame_t *frame, xlator_t *this,
87c3ef
-                                  inode_t *inode, gf_boolean_t *esh,
87c3ef
-                                  unsigned char *pflag)
87c3ef
+static int
87c3ef
+afr_update_heal_status(xlator_t *this, struct afr_reply *replies,
87c3ef
+                       char *index_vgfid, ia_type_t ia_type, gf_boolean_t *esh,
87c3ef
+                       gf_boolean_t *dsh, gf_boolean_t *msh)
87c3ef
 {
87c3ef
     int ret = -1;
87c3ef
-    int source = -1;
87c3ef
+    GF_UNUSED int ret1 = 0;
87c3ef
+    int i = 0;
87c3ef
+    int io_domain_lk_count = 0;
87c3ef
+    int shd_domain_lk_count = 0;
87c3ef
     afr_private_t *priv = NULL;
87c3ef
-    unsigned char *locked_on = NULL;
87c3ef
-    unsigned char *data_lock = NULL;
87c3ef
-    unsigned char *sources = NULL;
87c3ef
-    unsigned char *sinks = NULL;
87c3ef
-    unsigned char *healed_sinks = NULL;
87c3ef
-    struct afr_reply *locked_replies = NULL;
87c3ef
-    gf_boolean_t granular_locks = _gf_false;
87c3ef
+    char *key1 = NULL;
87c3ef
+    char *key2 = NULL;
87c3ef
 
87c3ef
     priv = this->private;
87c3ef
-    granular_locks = priv->granular_locks; /*Assign to local variable so that
87c3ef
-                                             reconfigure doesn't change this
87c3ef
-                                             value between locking and unlocking
87c3ef
-                                             below*/
87c3ef
-    locked_on = alloca0(priv->child_count);
87c3ef
-    data_lock = alloca0(priv->child_count);
87c3ef
-    sources = alloca0(priv->child_count);
87c3ef
-    sinks = alloca0(priv->child_count);
87c3ef
-    healed_sinks = alloca0(priv->child_count);
87c3ef
-
87c3ef
-    locked_replies = alloca0(sizeof(*locked_replies) * priv->child_count);
87c3ef
+    key1 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 +
87c3ef
+                   strlen(this->name));
87c3ef
+    key2 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 +
87c3ef
+                   strlen(priv->sh_domain));
87c3ef
+    sprintf(key1, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, this->name);
87c3ef
+    sprintf(key2, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, priv->sh_domain);
87c3ef
 
87c3ef
-    if (!granular_locks) {
87c3ef
-        ret = afr_selfheal_tryentrylk(frame, this, inode, priv->sh_domain, NULL,
87c3ef
-                                      locked_on);
87c3ef
-    }
87c3ef
-    {
87c3ef
-        if (!granular_locks && ret == 0) {
87c3ef
-            ret = -afr_final_errno(frame->local, priv);
87c3ef
-            if (ret == 0)
87c3ef
-                ret = -ENOTCONN; /* all invalid responses */
87c3ef
-            goto out;
87c3ef
+    for (i = 0; i < priv->child_count; i++) {
87c3ef
+        if ((replies[i].valid != 1) || (replies[i].op_ret != 0))
87c3ef
+            continue;
87c3ef
+        if (!io_domain_lk_count) {
87c3ef
+            ret1 = dict_get_int32(replies[i].xdata, key1, &io_domain_lk_count);
87c3ef
         }
87c3ef
+        if (!shd_domain_lk_count) {
87c3ef
+            ret1 = dict_get_int32(replies[i].xdata, key2, &shd_domain_lk_count);
87c3ef
+        }
87c3ef
+    }
87c3ef
 
87c3ef
-        ret = afr_selfheal_entrylk(frame, this, inode, this->name, NULL,
87c3ef
-                                   data_lock);
87c3ef
-        {
87c3ef
-            if (ret == 0) {
87c3ef
-                ret = -afr_final_errno(frame->local, priv);
87c3ef
-                if (ret == 0)
87c3ef
-                    ret = -ENOTCONN;
87c3ef
-                /* all invalid responses */
87c3ef
-                goto unlock;
87c3ef
-            }
87c3ef
-            ret = __afr_selfheal_entry_prepare(frame, this, inode, data_lock,
87c3ef
-                                               sources, sinks, healed_sinks,
87c3ef
-                                               locked_replies, &source, pflag);
87c3ef
-            if ((ret == 0) && (*pflag & PFLAG_SBRAIN))
87c3ef
-                ret = -EIO;
87c3ef
-            *esh = afr_decide_heal_info(priv, sources, ret);
87c3ef
+    if (!strcmp(index_vgfid, GF_XATTROP_INDEX_GFID)) {
87c3ef
+        if (shd_domain_lk_count) {
87c3ef
+            ret = -EAGAIN; /*For 'possibly-healing'. */
87c3ef
+        } else {
87c3ef
+            ret = 0; /*needs heal. Just set a non -ve value so that it is
87c3ef
+                       assumed as the source index.*/
87c3ef
+        }
87c3ef
+    } else if (!strcmp(index_vgfid, GF_XATTROP_DIRTY_GFID)) {
87c3ef
+        if ((afr_is_dirty_count_non_unary(this, replies, ia_type)) ||
87c3ef
+            (!io_domain_lk_count)) {
87c3ef
+            /* Needs heal. */
87c3ef
+            ret = 0;
87c3ef
+        } else {
87c3ef
+            /* No heal needed. */
87c3ef
+            *dsh = *esh = *msh = 0;
87c3ef
         }
87c3ef
-        afr_selfheal_unentrylk(frame, this, inode, this->name, NULL, data_lock,
87c3ef
-                               NULL);
87c3ef
     }
87c3ef
-unlock:
87c3ef
-    if (!granular_locks)
87c3ef
-        afr_selfheal_unentrylk(frame, this, inode, priv->sh_domain, NULL,
87c3ef
-                               locked_on, NULL);
87c3ef
-out:
87c3ef
-    if (locked_replies)
87c3ef
-        afr_replies_wipe(locked_replies, priv->child_count);
87c3ef
     return ret;
87c3ef
 }
87c3ef
 
87c3ef
+/*return EIO, EAGAIN or pending*/
87c3ef
 int
87c3ef
-afr_selfheal_locked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
87c3ef
-                            inode_t **inode, gf_boolean_t *entry_selfheal,
87c3ef
-                            gf_boolean_t *data_selfheal,
87c3ef
-                            gf_boolean_t *metadata_selfheal,
87c3ef
-                            unsigned char *pending)
87c3ef
-
87c3ef
+afr_lockless_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
87c3ef
+                     inode_t **inode, char *index_vgfid,
87c3ef
+                     gf_boolean_t *entry_selfheal, gf_boolean_t *data_selfheal,
87c3ef
+                     gf_boolean_t *metadata_selfheal, unsigned char *pending)
87c3ef
 {
87c3ef
     int ret = -1;
87c3ef
-    fd_t *fd = NULL;
87c3ef
+    int i = 0;
87c3ef
+    afr_private_t *priv = NULL;
87c3ef
+    struct afr_reply *replies = NULL;
87c3ef
     gf_boolean_t dsh = _gf_false;
87c3ef
     gf_boolean_t msh = _gf_false;
87c3ef
     gf_boolean_t esh = _gf_false;
87c3ef
+    unsigned char *sources = NULL;
87c3ef
+    unsigned char *sinks = NULL;
87c3ef
+    unsigned char *valid_on = NULL;
87c3ef
+    uint64_t *witness = NULL;
87c3ef
+
87c3ef
+    priv = this->private;
87c3ef
+    replies = alloca0(sizeof(*replies) * priv->child_count);
87c3ef
+    sources = alloca0(sizeof(*sources) * priv->child_count);
87c3ef
+    sinks = alloca0(sizeof(*sinks) * priv->child_count);
87c3ef
+    witness = alloca0(sizeof(*witness) * priv->child_count);
87c3ef
+    valid_on = alloca0(sizeof(*valid_on) * priv->child_count);
87c3ef
 
87c3ef
     ret = afr_selfheal_unlocked_inspect(frame, this, gfid, inode, &dsh, &msh,
87c3ef
-                                        &esh;;
87c3ef
+                                        &esh, replies);
87c3ef
     if (ret)
87c3ef
         goto out;
87c3ef
-
87c3ef
-    /* For every heal type hold locks and check if it indeed needs heal */
87c3ef
-
87c3ef
-    /* Heal-info does an open() on the file being examined so that the
87c3ef
-     * current eager-lock holding client, if present, at some point sees
87c3ef
-     * open-fd count being > 1 and releases the eager-lock so that heal-info
87c3ef
-     * doesn't remain blocked forever until IO completes.
87c3ef
-     */
87c3ef
-    if ((*inode)->ia_type == IA_IFREG) {
87c3ef
-        ret = afr_selfheal_data_open(this, *inode, &fd;;
87c3ef
-        if (ret < 0) {
87c3ef
-            gf_msg_debug(this->name, -ret, "%s: Failed to open",
87c3ef
-                         uuid_utoa((*inode)->gfid));
87c3ef
-            goto out;
87c3ef
+    for (i = 0; i < priv->child_count; i++) {
87c3ef
+        if (replies[i].valid && replies[i].op_ret == 0) {
87c3ef
+            valid_on[i] = 1;
87c3ef
         }
87c3ef
     }
87c3ef
-
87c3ef
     if (msh) {
87c3ef
-        ret = afr_selfheal_locked_metadata_inspect(frame, this, *inode, &msh,
87c3ef
-                                                   pending);
87c3ef
-        if (ret == -EIO)
87c3ef
+        ret = afr_selfheal_find_direction(frame, this, replies,
87c3ef
+                                          AFR_METADATA_TRANSACTION, valid_on,
87c3ef
+                                          sources, sinks, witness, pending);
87c3ef
+        if (*pending & PFLAG_SBRAIN)
87c3ef
+            ret = -EIO;
87c3ef
+        if (ret)
87c3ef
             goto out;
87c3ef
     }
87c3ef
-
87c3ef
     if (dsh) {
87c3ef
-        ret = afr_selfheal_locked_data_inspect(frame, this, fd, &dsh, pending);
87c3ef
-        if (ret == -EIO || (ret == -EAGAIN))
87c3ef
+        ret = afr_selfheal_find_direction(frame, this, replies,
87c3ef
+                                          AFR_DATA_TRANSACTION, valid_on,
87c3ef
+                                          sources, sinks, witness, pending);
87c3ef
+        if (*pending & PFLAG_SBRAIN)
87c3ef
+            ret = -EIO;
87c3ef
+        if (ret)
87c3ef
             goto out;
87c3ef
     }
87c3ef
-
87c3ef
     if (esh) {
87c3ef
-        ret = afr_selfheal_locked_entry_inspect(frame, this, *inode, &esh,
87c3ef
-                                                pending);
87c3ef
+        ret = afr_selfheal_find_direction(frame, this, replies,
87c3ef
+                                          AFR_ENTRY_TRANSACTION, valid_on,
87c3ef
+                                          sources, sinks, witness, pending);
87c3ef
+        if (*pending & PFLAG_SBRAIN)
87c3ef
+            ret = -EIO;
87c3ef
+        if (ret)
87c3ef
+            goto out;
87c3ef
     }
87c3ef
 
87c3ef
+    ret = afr_update_heal_status(this, replies, index_vgfid, (*inode)->ia_type,
87c3ef
+                                 &esh, &dsh, &msh;;
87c3ef
 out:
87c3ef
     *data_selfheal = dsh;
87c3ef
     *entry_selfheal = esh;
87c3ef
     *metadata_selfheal = msh;
87c3ef
-    if (fd)
87c3ef
-        fd_unref(fd);
87c3ef
+    if (replies)
87c3ef
+        afr_replies_wipe(replies, priv->child_count);
87c3ef
     return ret;
87c3ef
 }
87c3ef
 
87c3ef
-static dict_t *
87c3ef
-afr_set_heal_info(char *status)
87c3ef
-{
87c3ef
-    dict_t *dict = NULL;
87c3ef
-    int ret = -1;
87c3ef
-
87c3ef
-    dict = dict_new();
87c3ef
-    if (!dict) {
87c3ef
-        ret = -ENOMEM;
87c3ef
-        goto out;
87c3ef
-    }
87c3ef
-
87c3ef
-    ret = dict_set_dynstr_sizen(dict, "heal-info", status);
87c3ef
-    if (ret)
87c3ef
-        gf_msg("", GF_LOG_WARNING, -ret, AFR_MSG_DICT_SET_FAILED,
87c3ef
-               "Failed to set heal-info key to "
87c3ef
-               "%s",
87c3ef
-               status);
87c3ef
-out:
87c3ef
-    /* Any error other than EINVAL, dict_set_dynstr frees status */
87c3ef
-    if (ret == -ENOMEM || ret == -EINVAL) {
87c3ef
-        GF_FREE(status);
87c3ef
-    }
87c3ef
-
87c3ef
-    if (ret && dict) {
87c3ef
-        dict_unref(dict);
87c3ef
-        dict = NULL;
87c3ef
-    }
87c3ef
-    return dict;
87c3ef
-}
87c3ef
-
87c3ef
 int
87c3ef
 afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc)
87c3ef
 {
87c3ef
@@ -6174,10 +6133,18 @@ afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc)
87c3ef
     inode_t *inode = NULL;
87c3ef
     char *substr = NULL;
87c3ef
     char *status = NULL;
87c3ef
+    afr_local_t *local = NULL;
87c3ef
+    char *index_vgfid = NULL;
87c3ef
+
87c3ef
+    local = frame->local;
87c3ef
+    if (dict_get_str(local->xdata_req, "index-vgfid", &index_vgfid)) {
87c3ef
+        ret = -1;
87c3ef
+        goto out;
87c3ef
+    }
87c3ef
 
87c3ef
-    ret = afr_selfheal_locked_inspect(frame, this, loc->gfid, &inode,
87c3ef
-                                      &entry_selfheal, &data_selfheal,
87c3ef
-                                      &metadata_selfheal, &pending);
87c3ef
+    ret = afr_lockless_inspect(frame, this, loc->gfid, &inode, index_vgfid,
87c3ef
+                               &entry_selfheal, &data_selfheal,
87c3ef
+                               &metadata_selfheal, &pending);
87c3ef
 
87c3ef
     if (ret == -ENOMEM) {
87c3ef
         ret = -1;
87c3ef
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
87c3ef
index d942ccf..1608f75 100644
87c3ef
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
87c3ef
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
87c3ef
@@ -1827,6 +1827,37 @@ afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent,
87c3ef
     return inode;
87c3ef
 }
87c3ef
 
87c3ef
+static int
87c3ef
+afr_set_multi_dom_lock_count_request(xlator_t *this, dict_t *dict)
87c3ef
+{
87c3ef
+    int ret = 0;
87c3ef
+    afr_private_t *priv = NULL;
87c3ef
+    char *key1 = NULL;
87c3ef
+    char *key2 = NULL;
87c3ef
+
87c3ef
+    priv = this->private;
87c3ef
+    key1 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 +
87c3ef
+                   strlen(this->name));
87c3ef
+    key2 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 +
87c3ef
+                   strlen(priv->sh_domain));
87c3ef
+
87c3ef
+    ret = dict_set_uint32(dict, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS, 1);
87c3ef
+    if (ret)
87c3ef
+        return ret;
87c3ef
+
87c3ef
+    sprintf(key1, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, this->name);
87c3ef
+    ret = dict_set_uint32(dict, key1, 1);
87c3ef
+    if (ret)
87c3ef
+        return ret;
87c3ef
+
87c3ef
+    sprintf(key2, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, priv->sh_domain);
87c3ef
+    ret = dict_set_uint32(dict, key2, 1);
87c3ef
+    if (ret)
87c3ef
+        return ret;
87c3ef
+
87c3ef
+    return 0;
87c3ef
+}
87c3ef
+
87c3ef
 int
87c3ef
 afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode,
87c3ef
                                   uuid_t gfid, struct afr_reply *replies,
87c3ef
@@ -1851,6 +1882,11 @@ afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode,
87c3ef
         return -ENOMEM;
87c3ef
     }
87c3ef
 
87c3ef
+    if (afr_set_multi_dom_lock_count_request(frame->this, xattr_req)) {
87c3ef
+        dict_unref(xattr_req);
87c3ef
+        return -1;
87c3ef
+    }
87c3ef
+
87c3ef
     loc.inode = inode_ref(inode);
87c3ef
     gf_uuid_copy(loc.gfid, gfid);
87c3ef
 
87c3ef
@@ -2241,7 +2277,8 @@ int
87c3ef
 afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
87c3ef
                               inode_t **link_inode, gf_boolean_t *data_selfheal,
87c3ef
                               gf_boolean_t *metadata_selfheal,
87c3ef
-                              gf_boolean_t *entry_selfheal)
87c3ef
+                              gf_boolean_t *entry_selfheal,
87c3ef
+                              struct afr_reply *replies_dst)
87c3ef
 {
87c3ef
     afr_private_t *priv = NULL;
87c3ef
     inode_t *inode = NULL;
87c3ef
@@ -2377,6 +2414,8 @@ afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
87c3ef
 
87c3ef
     ret = 0;
87c3ef
 out:
87c3ef
+    if (replies && replies_dst)
87c3ef
+        afr_replies_copy(replies_dst, replies, priv->child_count);
87c3ef
     if (inode)
87c3ef
         inode_unref(inode);
87c3ef
     if (replies)
87c3ef
@@ -2493,7 +2532,7 @@ afr_selfheal_do(call_frame_t *frame, xlator_t *this, uuid_t gfid)
87c3ef
 
87c3ef
     ret = afr_selfheal_unlocked_inspect(frame, this, gfid, &inode,
87c3ef
                                         &data_selfheal, &metadata_selfheal,
87c3ef
-                                        &entry_selfheal);
87c3ef
+                                        &entry_selfheal, NULL);
87c3ef
     if (ret)
87c3ef
         goto out;
87c3ef
 
87c3ef
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
87c3ef
index f7ecf5d..b39af02 100644
87c3ef
--- a/xlators/cluster/afr/src/afr-self-heal.h
87c3ef
+++ b/xlators/cluster/afr/src/afr-self-heal.h
87c3ef
@@ -327,7 +327,8 @@ int
87c3ef
 afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
87c3ef
                               inode_t **link_inode, gf_boolean_t *data_selfheal,
87c3ef
                               gf_boolean_t *metadata_selfheal,
87c3ef
-                              gf_boolean_t *entry_selfheal);
87c3ef
+                              gf_boolean_t *entry_selfheal,
87c3ef
+                              struct afr_reply *replies);
87c3ef
 
87c3ef
 int
87c3ef
 afr_selfheal_do(call_frame_t *frame, xlator_t *this, uuid_t gfid);
87c3ef
diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h
87c3ef
index 3a74967..ea86b96 100644
87c3ef
--- a/xlators/features/locks/src/common.h
87c3ef
+++ b/xlators/features/locks/src/common.h
87c3ef
@@ -45,6 +45,10 @@
87c3ef
                 fd_unref(__local->fd);                                         \
87c3ef
             if (__local->inode)                                                \
87c3ef
                 inode_unref(__local->inode);                                   \
87c3ef
+            if (__local->xdata) {                                              \
87c3ef
+                dict_unref(__local->xdata);                                    \
87c3ef
+                __local->xdata = NULL;                                         \
87c3ef
+            }                                                                  \
87c3ef
             mem_put(__local);                                                  \
87c3ef
         }                                                                      \
87c3ef
     } while (0)
87c3ef
diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h
87c3ef
index b817960..aa267de 100644
87c3ef
--- a/xlators/features/locks/src/locks.h
87c3ef
+++ b/xlators/features/locks/src/locks.h
87c3ef
@@ -239,6 +239,7 @@ typedef struct {
87c3ef
     gf_boolean_t inodelk_count_req;
87c3ef
     gf_boolean_t posixlk_count_req;
87c3ef
     gf_boolean_t parent_entrylk_req;
87c3ef
+    gf_boolean_t multiple_dom_lk_requests;
87c3ef
     int update_mlock_enforced_flag;
87c3ef
 } pl_local_t;
87c3ef
 
87c3ef
@@ -260,6 +261,13 @@ typedef struct _locks_ctx {
87c3ef
     struct list_head metalk_list;
87c3ef
 } pl_ctx_t;
87c3ef
 
87c3ef
+typedef struct _multi_dom_lk_data {
87c3ef
+    xlator_t *this;
87c3ef
+    inode_t *inode;
87c3ef
+    dict_t *xdata_rsp;
87c3ef
+    gf_boolean_t keep_max;
87c3ef
+} multi_dom_lk_data;
87c3ef
+
87c3ef
 typedef enum { DECREMENT, INCREMENT } pl_count_op_t;
87c3ef
 
87c3ef
 pl_ctx_t *
87c3ef
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
87c3ef
index 4592240..9a14c64 100644
87c3ef
--- a/xlators/features/locks/src/posix.c
87c3ef
+++ b/xlators/features/locks/src/posix.c
87c3ef
@@ -150,13 +150,20 @@ fetch_pathinfo(xlator_t *, inode_t *, int32_t *, char **);
87c3ef
 gf_boolean_t
87c3ef
 pl_has_xdata_requests(dict_t *xdata)
87c3ef
 {
87c3ef
-    static char *reqs[] = {GLUSTERFS_ENTRYLK_COUNT,     GLUSTERFS_INODELK_COUNT,
87c3ef
-                           GLUSTERFS_INODELK_DOM_COUNT, GLUSTERFS_POSIXLK_COUNT,
87c3ef
-                           GLUSTERFS_PARENT_ENTRYLK,    NULL};
87c3ef
-    static int reqs_size[] = {
87c3ef
-        SLEN(GLUSTERFS_ENTRYLK_COUNT),     SLEN(GLUSTERFS_INODELK_COUNT),
87c3ef
-        SLEN(GLUSTERFS_INODELK_DOM_COUNT), SLEN(GLUSTERFS_POSIXLK_COUNT),
87c3ef
-        SLEN(GLUSTERFS_PARENT_ENTRYLK),    0};
87c3ef
+    static char *reqs[] = {GLUSTERFS_ENTRYLK_COUNT,
87c3ef
+                           GLUSTERFS_INODELK_COUNT,
87c3ef
+                           GLUSTERFS_INODELK_DOM_COUNT,
87c3ef
+                           GLUSTERFS_POSIXLK_COUNT,
87c3ef
+                           GLUSTERFS_PARENT_ENTRYLK,
87c3ef
+                           GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS,
87c3ef
+                           NULL};
87c3ef
+    static int reqs_size[] = {SLEN(GLUSTERFS_ENTRYLK_COUNT),
87c3ef
+                              SLEN(GLUSTERFS_INODELK_COUNT),
87c3ef
+                              SLEN(GLUSTERFS_INODELK_DOM_COUNT),
87c3ef
+                              SLEN(GLUSTERFS_POSIXLK_COUNT),
87c3ef
+                              SLEN(GLUSTERFS_PARENT_ENTRYLK),
87c3ef
+                              SLEN(GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS),
87c3ef
+                              0};
87c3ef
     int i = 0;
87c3ef
 
87c3ef
     if (!xdata)
87c3ef
@@ -169,12 +176,22 @@ pl_has_xdata_requests(dict_t *xdata)
87c3ef
     return _gf_false;
87c3ef
 }
87c3ef
 
87c3ef
+static int
87c3ef
+dict_delete_domain_key(dict_t *dict, char *key, data_t *value, void *data)
87c3ef
+{
87c3ef
+    dict_del(dict, key);
87c3ef
+    return 0;
87c3ef
+}
87c3ef
+
87c3ef
 void
87c3ef
 pl_get_xdata_requests(pl_local_t *local, dict_t *xdata)
87c3ef
 {
87c3ef
     if (!local || !xdata)
87c3ef
         return;
87c3ef
 
87c3ef
+    GF_ASSERT(local->xdata == NULL);
87c3ef
+    local->xdata = dict_copy_with_ref(xdata, NULL);
87c3ef
+
87c3ef
     if (dict_get_sizen(xdata, GLUSTERFS_ENTRYLK_COUNT)) {
87c3ef
         local->entrylk_count_req = 1;
87c3ef
         dict_del_sizen(xdata, GLUSTERFS_ENTRYLK_COUNT);
87c3ef
@@ -183,6 +200,12 @@ pl_get_xdata_requests(pl_local_t *local, dict_t *xdata)
87c3ef
         local->inodelk_count_req = 1;
87c3ef
         dict_del_sizen(xdata, GLUSTERFS_INODELK_COUNT);
87c3ef
     }
87c3ef
+    if (dict_get_sizen(xdata, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS)) {
87c3ef
+        local->multiple_dom_lk_requests = 1;
87c3ef
+        dict_del_sizen(xdata, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS);
87c3ef
+        dict_foreach_fnmatch(xdata, GLUSTERFS_INODELK_DOM_PREFIX "*",
87c3ef
+                             dict_delete_domain_key, NULL);
87c3ef
+    }
87c3ef
 
87c3ef
     local->inodelk_dom_count_req = dict_get_sizen(xdata,
87c3ef
                                                   GLUSTERFS_INODELK_DOM_COUNT);
87c3ef
@@ -210,7 +233,7 @@ pl_needs_xdata_response(pl_local_t *local)
87c3ef
 
87c3ef
     if (local->parent_entrylk_req || local->entrylk_count_req ||
87c3ef
         local->inodelk_dom_count_req || local->inodelk_count_req ||
87c3ef
-        local->posixlk_count_req)
87c3ef
+        local->posixlk_count_req || local->multiple_dom_lk_requests)
87c3ef
         return _gf_true;
87c3ef
 
87c3ef
     return _gf_false;
87c3ef
@@ -411,6 +434,75 @@ pl_posixlk_xattr_fill(xlator_t *this, inode_t *inode, dict_t *dict,
87c3ef
 }
87c3ef
 
87c3ef
 void
87c3ef
+pl_inodelk_xattr_fill_each(xlator_t *this, inode_t *inode, dict_t *dict,
87c3ef
+                           char *domname, gf_boolean_t keep_max, char *key)
87c3ef
+{
87c3ef
+    int32_t count = 0;
87c3ef
+    int32_t maxcount = -1;
87c3ef
+    int ret = -1;
87c3ef
+
87c3ef
+    if (keep_max) {
87c3ef
+        ret = dict_get_int32(dict, key, &maxcount);
87c3ef
+        if (ret < 0)
87c3ef
+            gf_msg_debug(this->name, 0, " Failed to fetch the value for key %s",
87c3ef
+                         GLUSTERFS_INODELK_COUNT);
87c3ef
+    }
87c3ef
+    count = get_inodelk_count(this, inode, domname);
87c3ef
+    if (maxcount >= count)
87c3ef
+        return;
87c3ef
+
87c3ef
+    ret = dict_set_int32(dict, key, count);
87c3ef
+    if (ret < 0) {
87c3ef
+        gf_msg_debug(this->name, 0,
87c3ef
+                     "Failed to set count for "
87c3ef
+                     "key %s",
87c3ef
+                     key);
87c3ef
+    }
87c3ef
+
87c3ef
+    return;
87c3ef
+}
87c3ef
+
87c3ef
+static int
87c3ef
+pl_inodelk_xattr_fill_multiple(dict_t *this, char *key, data_t *value,
87c3ef
+                               void *data)
87c3ef
+{
87c3ef
+    multi_dom_lk_data *d = data;
87c3ef
+    char *tmp_key = NULL;
87c3ef
+    char *save_ptr = NULL;
87c3ef
+
87c3ef
+    tmp_key = gf_strdup(key);
87c3ef
+    strtok_r(tmp_key, ":", &save_ptr);
87c3ef
+    if (!*save_ptr) {
87c3ef
+        gf_msg(THIS->name, GF_LOG_ERROR, 0, EINVAL,
87c3ef
+               "Could not tokenize domain string from key %s", key);
87c3ef
+        return -1;
87c3ef
+    }
87c3ef
+
87c3ef
+    pl_inodelk_xattr_fill_each(d->this, d->inode, d->xdata_rsp, save_ptr,
87c3ef
+                               d->keep_max, key);
87c3ef
+    if (tmp_key)
87c3ef
+        GF_FREE(tmp_key);
87c3ef
+
87c3ef
+    return 0;
87c3ef
+}
87c3ef
+
87c3ef
+void
87c3ef
+pl_fill_multiple_dom_lk_requests(xlator_t *this, pl_local_t *local,
87c3ef
+                                 inode_t *inode, dict_t *dict,
87c3ef
+                                 gf_boolean_t keep_max)
87c3ef
+{
87c3ef
+    multi_dom_lk_data data;
87c3ef
+
87c3ef
+    data.this = this;
87c3ef
+    data.inode = inode;
87c3ef
+    data.xdata_rsp = dict;
87c3ef
+    data.keep_max = keep_max;
87c3ef
+
87c3ef
+    dict_foreach_fnmatch(local->xdata, GLUSTERFS_INODELK_DOM_PREFIX "*",
87c3ef
+                         pl_inodelk_xattr_fill_multiple, &data);
87c3ef
+}
87c3ef
+
87c3ef
+void
87c3ef
 pl_set_xdata_response(xlator_t *this, pl_local_t *local, inode_t *parent,
87c3ef
                       inode_t *inode, char *name, dict_t *xdata,
87c3ef
                       gf_boolean_t max_lock)
87c3ef
@@ -437,6 +529,9 @@ pl_set_xdata_response(xlator_t *this, pl_local_t *local, inode_t *parent,
87c3ef
 
87c3ef
     if (local->posixlk_count_req)
87c3ef
         pl_posixlk_xattr_fill(this, inode, xdata, max_lock);
87c3ef
+
87c3ef
+    if (local->multiple_dom_lk_requests)
87c3ef
+        pl_fill_multiple_dom_lk_requests(this, local, inode, xdata, max_lock);
87c3ef
 }
87c3ef
 
87c3ef
 /* Checks whether the region where fop is acting upon conflicts
87c3ef
@@ -773,9 +868,6 @@ pl_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
87c3ef
 {
87c3ef
     pl_local_t *local = frame->local;
87c3ef
 
87c3ef
-    if (local->xdata)
87c3ef
-        dict_unref(local->xdata);
87c3ef
-
87c3ef
     pl_track_io_fop_count(local, this, DECREMENT);
87c3ef
 
87c3ef
     if (local->op == GF_FOP_TRUNCATE)
87c3ef
@@ -932,9 +1024,6 @@ unwind:
87c3ef
                "ret: %d, error: %s",
87c3ef
                op_ret, strerror(op_errno));
87c3ef
 
87c3ef
-        if (local->xdata)
87c3ef
-            dict_unref(local->xdata);
87c3ef
-
87c3ef
         switch (local->op) {
87c3ef
             case GF_FOP_TRUNCATE:
87c3ef
                 PL_STACK_UNWIND(truncate, xdata, frame, op_ret, op_errno, buf,
87c3ef
-- 
87c3ef
1.8.3.1
87c3ef