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