summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-08-22 22:25:40 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-24 15:43:17 -0700
commita97ccc632fc425156e24b7c71de97248de62b2de (patch)
tree418858802cb7554f244be1420851c95dfce61093 /xlators/protocol/client/src
parentbf86f46151ab93354469298560aa2bca467fdce3 (diff)
protocol/client: Unserialize xdata even if lookup fails
Problem: AFR relies on xdata returned by lookup to determine if there are any files that need healing. This info is further used to optimize readdirp. In case of lookups with negative return value, client xlator was sending NULL xdata. Due to absence of xdata, AFR conservatively assumes that there are files that need healing, which is incorrect. Solution: Even in case of unsuccessful lookups, send the xdata received by protocol client so that higher xlators can get the info that they rely on. >Change-Id: Id3a1023eb536180888eb2c0b39050000b76f7226 >BUG: 1366284 >Signed-off-by: Anuradha Talur <atalur@redhat.com> >Reviewed-on: http://review.gluster.org/15120 >Smoke: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Poornima G <pgurusid@redhat.com> >Tested-by: Poornima G <pgurusid@redhat.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Ashish Pandey <aspandey@redhat.com> >Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> >Signed-off-by: Anuradha Talur <atalur@redhat.com> Change-Id: Ia22bcb200d599b78677e429d25877c78f7d27612 BUG: 1369211 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/15259 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 19b7cf6b0e9..a9ca27742da 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -2933,18 +2933,19 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
+ /* Preserve the op_errno sent by server */
op_errno = gf_error_to_errno (rsp.op_errno);
- gf_stat_to_iatt (&rsp.postparent, &postparent);
- if (rsp.op_ret == -1)
- goto out;
-
- rsp.op_ret = -1;
- gf_stat_to_iatt (&rsp.stat, &stbuf);
+ if (rsp.op_ret != -1) {
+ gf_stat_to_iatt (&rsp.postparent, &postparent);
+ gf_stat_to_iatt (&rsp.stat, &stbuf);
+ }
GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), rsp.op_ret,
- op_errno, out);
+ (rsp.xdata.xdata_len), ret,
+ rsp.op_errno, out);
+ if (rsp.op_ret < 0)
+ goto out;
if ((!gf_uuid_is_null (inode->gfid))
&& (gf_uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) {
@@ -2960,8 +2961,14 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
}
rsp.op_ret = 0;
-
+ ret = 0;
out:
+ /* If dict unserialize failed on a successful fop*/
+ if (rsp.op_ret == 0 && ret < 0) {
+ rsp.op_ret = -1;
+ op_errno = rsp.op_errno;
+ }
+ /* Restore appropriate op_errno in response */
rsp.op_errno = op_errno;
if (rsp.op_ret == -1) {
/* any error other than ENOENT */