summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-rpc-fops.c
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-08-09 21:09:11 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-17 03:26:05 -0700
commit59186114f9545fda529368ee26c3cd3d88a80751 (patch)
tree37a96322e38a277bd7a4da980a33899ea1c555e0 /xlators/protocol/client/src/client-rpc-fops.c
parentdd8d93f24a320805f1f67760b2d3266555acf674 (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>
Diffstat (limited to 'xlators/protocol/client/src/client-rpc-fops.c')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index d35d0e04861..b26c4946d7f 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -2893,13 +2893,19 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
+ /* Preserve the op_errno received from the server */
op_errno = gf_error_to_errno (rsp.op_errno);
- if (rsp.op_ret == -1)
+ ret = client_post_lookup (this, &rsp, &stbuf, &postparent, &xdata);
+ if (ret < 0) {
+ /* Don't change the op_errno if the fop failed on server */
+ if (rsp.op_ret == 0)
+ op_errno = rsp.op_errno;
+ rsp.op_ret = -1;
goto out;
+ }
- ret = client_post_lookup (this, &rsp, &stbuf, &postparent, &xdata);
- if (ret < 0)
+ if (rsp.op_ret < 0)
goto out;
if ((!gf_uuid_is_null (inode->gfid))
@@ -2918,6 +2924,7 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
rsp.op_ret = 0;
out:
+ /* Restore the correct op_errno to rsp.op_errno */
rsp.op_errno = op_errno;
if (rsp.op_ret == -1) {
/* any error other than ENOENT */