summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/protocol/client/src/client-common.c6
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c13
2 files changed, 13 insertions, 6 deletions
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c
index 51c2d95ea2b..05939b8aa0b 100644
--- a/xlators/protocol/client/src/client-common.c
+++ b/xlators/protocol/client/src/client-common.c
@@ -1829,6 +1829,7 @@ int
client_post_lookup (xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
struct iatt *postparent, dict_t **xdata)
{
+ int ret = 0;
if (-1 != rsp->op_ret) {
gf_stat_to_iatt (&rsp->postparent, postparent);
@@ -1836,11 +1837,10 @@ client_post_lookup (xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
}
GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), rsp->op_ret,
+ (rsp->xdata.xdata_len), ret,
rsp->op_errno, out);
-
out:
- return rsp->op_ret;
+ return ret;
}
int
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 */