diff options
author | Mohammed Rafi KC <rkavunga@redhat.com> | 2019-07-10 21:44:38 +0530 |
---|---|---|
committer | hari gowtham <hari.gowtham005@gmail.com> | 2019-09-23 07:00:22 +0000 |
commit | 850f20c5aeb0c935be99bef13e8a49bd52f186ff (patch) | |
tree | 4a421af790969624abb8be2656cd57e2fde4b309 /xlators | |
parent | 78dcb37405be16f529d2efaaebcedd461d4f987c (diff) |
afr/lookup: Pass xattr_req in while doing a selfheal in lookup
We were not passing xattr_req when doing a name self heal
as well as a meta data heal. Because of this, some xdata
was missing which causes i/o errors
Backport of > https://review.gluster.org/#/c/glusterfs/+/23024/
>Change-Id: Ibfb1205a7eb0195632dc3820116ffbbb8043545f
>Fixes: bz#1728770
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Fixes: bz#1749307
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
(cherry picked from commit d026f0bcfd301712e4f0671ccf238f43f2e6dd30)
Change-Id: Ibfb1205a7eb0195632dc3820116ffbbb8043545f
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 8 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 11 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal.h | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 5f8159304cf..9a6475b6ec8 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -2609,6 +2609,10 @@ afr_lookup_sh_metadata_wrap(void *opaque) dict = dict_new(); if (!dict) goto out; + if (local->xattr_req) { + dict_copy(local->xattr_req, dict); + } + ret = dict_set_sizen_str_sizen(dict, "link-count", GF_XATTROP_INDEX_COUNT); if (ret) { gf_msg_debug(this->name, -ret, "Unable to set link-count in dict "); @@ -2617,7 +2621,7 @@ afr_lookup_sh_metadata_wrap(void *opaque) if (loc_is_nameless(&local->loc)) { ret = afr_selfheal_unlocked_discover_on(frame, local->inode, local->loc.gfid, local->replies, - local->child_up); + local->child_up, dict); } else { inode = afr_selfheal_unlocked_lookup_on(frame, local->loc.parent, local->loc.name, local->replies, @@ -2791,7 +2795,7 @@ afr_lookup_selfheal_wrap(void *opaque) inode = afr_selfheal_unlocked_lookup_on(frame, local->loc.parent, local->loc.name, local->replies, - local->child_up, NULL); + local->child_up, local->xattr_req); if (inode) inode_unref(inode); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 595bed4d2dd..5115248aefa 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1827,7 +1827,7 @@ afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent, int afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, uuid_t gfid, struct afr_reply *replies, - unsigned char *discover_on) + unsigned char *discover_on, dict_t *dict) { loc_t loc = { 0, @@ -1842,6 +1842,8 @@ afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, xattr_req = dict_new(); if (!xattr_req) return -ENOMEM; + if (dict) + dict_copy(dict, xattr_req); if (afr_xattr_req_prepare(frame->this, xattr_req) != 0) { dict_unref(xattr_req); @@ -1867,11 +1869,16 @@ afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid, struct afr_reply *replies) { afr_private_t *priv = NULL; + afr_local_t *local = NULL; + dict_t *dict = NULL; priv = frame->this->private; + local = frame->local; + if (local && local->xattr_req) + dict = local->xattr_req; return afr_selfheal_unlocked_discover_on(frame, inode, gfid, replies, - priv->child_up); + priv->child_up, dict); } unsigned int diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h index 6555ec55771..703f80e05cb 100644 --- a/xlators/cluster/afr/src/afr-self-heal.h +++ b/xlators/cluster/afr/src/afr-self-heal.h @@ -187,7 +187,7 @@ afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid, int afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, uuid_t gfid, struct afr_reply *replies, - unsigned char *discover_on); + unsigned char *discover_on, dict_t *dict); inode_t * afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent, const char *name, struct afr_reply *replies, |