diff options
author | Raghavendra G <raghavendra@gluster.com> | 2012-03-08 10:59:43 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-03-18 01:52:04 -0700 |
commit | 4d4a1e0801d1a7b2b3ec226309809c5fddd84319 (patch) | |
tree | b2b7372f4a99e7cf42bc6c343cdd42b6d8c96cb7 /xlators/protocol/client/src/client.c | |
parent | 968c6ba70cbcc058823947cc925072e03cbb0ac8 (diff) |
rpc: don't unwind the fop in caller if client_submit_request fails
client_submit_request guarantees that the cbkfn - which we pass to
it as argument - is called whenever there is a failure.
Change-Id: I0e8ce5a6b320246dc13ce4318b04739d38d183a3
BUG: 767359
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/2896
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client.c')
-rw-r--r-- | xlators/protocol/client/src/client.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index d01848f0a70..00ec90ff00b 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -118,20 +118,21 @@ out: int client_submit_request (xlator_t *this, void *req, call_frame_t *frame, - rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbk, + rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, struct iobref *iobref, struct iovec *rsphdr, int rsphdr_count, struct iovec *rsp_payload, int rsp_payload_count, struct iobref *rsp_iobref, xdrproc_t xdrproc) { - int ret = -1; - clnt_conf_t *conf = NULL; - struct iovec iov = {0, }; - struct iobuf *iobuf = NULL; - int count = 0; - char start_ping = 0; - struct iobref *new_iobref = NULL; - ssize_t xdr_size = 0; + int ret = -1; + clnt_conf_t *conf = NULL; + struct iovec iov = {0, }; + struct iobuf *iobuf = NULL; + int count = 0; + char start_ping = 0; + struct iobref *new_iobref = NULL; + ssize_t xdr_size = 0; + struct rpc_req rpcreq = {0, }; GF_VALIDATE_OR_GOTO ("client", this, out); GF_VALIDATE_OR_GOTO (this->name, prog, out); @@ -199,8 +200,8 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, } /* Send the msg */ - ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbk, &iov, count, NULL, - 0, new_iobref, frame, rsphdr, rsphdr_count, + ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, + NULL, 0, new_iobref, frame, rsphdr, rsphdr_count, rsp_payload, rsp_payload_count, rsp_iobref); if (ret < 0) { @@ -221,7 +222,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, client_start_ping ((void *) this); ret = 0; -out: + if (new_iobref != NULL) iobref_unref (new_iobref); @@ -229,6 +230,19 @@ out: iobuf_unref (iobuf); return ret; + +out: + rpcreq.rpc_status = -1; + + cbkfn (&rpcreq, NULL, 0, frame); + + if (new_iobref != NULL) { + iobref_unref (new_iobref); + } + + iobuf_unref (iobuf); + + return 0; } |