diff options
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index ae03c9c913f..fc00793322c 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1833,6 +1833,37 @@ afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent, return inode; } +static int +afr_set_multi_dom_lock_count_request(xlator_t *this, dict_t *dict) +{ + int ret = 0; + afr_private_t *priv = NULL; + char *key1 = NULL; + char *key2 = NULL; + + priv = this->private; + key1 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 + + strlen(this->name)); + key2 = alloca0(strlen(GLUSTERFS_INODELK_DOM_PREFIX) + 2 + + strlen(priv->sh_domain)); + + ret = dict_set_uint32(dict, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS, 1); + if (ret) + return ret; + + sprintf(key1, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, this->name); + ret = dict_set_uint32(dict, key1, 1); + if (ret) + return ret; + + sprintf(key2, "%s:%s", GLUSTERFS_INODELK_DOM_PREFIX, priv->sh_domain); + ret = dict_set_uint32(dict, key2, 1); + if (ret) + return ret; + + return 0; +} + int afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, uuid_t gfid, struct afr_reply *replies, @@ -1859,6 +1890,11 @@ afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, return -ENOMEM; } + if (afr_set_multi_dom_lock_count_request(frame->this, xattr_req)) { + dict_unref(xattr_req); + return -1; + } + loc.inode = inode_ref(inode); gf_uuid_copy(loc.gfid, gfid); @@ -2254,7 +2290,8 @@ int afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid, inode_t **link_inode, gf_boolean_t *data_selfheal, gf_boolean_t *metadata_selfheal, - gf_boolean_t *entry_selfheal) + gf_boolean_t *entry_selfheal, + struct afr_reply *replies_dst) { afr_private_t *priv = NULL; inode_t *inode = NULL; @@ -2390,6 +2427,8 @@ afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid, ret = 0; out: + if (replies && replies_dst) + afr_replies_copy(replies_dst, replies, priv->child_count); if (inode) inode_unref(inode); if (replies) @@ -2509,7 +2548,7 @@ afr_selfheal_do(call_frame_t *frame, xlator_t *this, uuid_t gfid) ret = afr_selfheal_unlocked_inspect(frame, this, gfid, &inode, &data_selfheal, &metadata_selfheal, - &entry_selfheal); + &entry_selfheal, NULL); if (ret) goto out; |