From fb5e9b848c2dd358dc23fe56e0e95d3bfd3b9f72 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Fri, 18 May 2012 08:14:07 +0530 Subject: glusterfs/rebalance: Register cbk for glusterfs_rebalance_event_notify In case of n/w failures, cbk needs to be passed to mgmt_submit_request. Change-Id: I519720dbdde4c8d46381144403751bf7ed6d3a51 BUG: 822086 Signed-off-by: shishir gowda Reviewed-on: http://review.gluster.com/3359 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Krishnan Parthasarathi Reviewed-by: Anand Avati --- glusterfsd/src/glusterfsd-mgmt.c | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 751e5495f45..d8582aa7013 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -1684,6 +1684,47 @@ out: return ret; } + +int32_t +glusterfs_rebalance_event_notify_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + gf_event_notify_rsp rsp = {0,}; + call_frame_t *frame = NULL; + glusterfs_ctx_t *ctx = NULL; + int ret = 0; + + frame = myframe; + ctx = frame->this->ctx; + + if (-1 == req->rpc_status) { + gf_log (frame->this->name, GF_LOG_ERROR, + "failed to get the rsp from server"); + ret = -1; + goto out; + } + + ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_event_notify_rsp); + if (ret < 0) { + gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding error"); + ret = -1; + goto out; + } + + if (-1 == rsp.op_ret) { + gf_log (frame->this->name, GF_LOG_ERROR, + "Recieved error (%s) from server", + strerror (rsp.op_errno)); + ret = -1; + goto out; + } +out: + if (rsp.dict.dict_val) + free (rsp.dict.dict_val); //malloced by xdr + return ret; + +} + int32_t glusterfs_rebalance_event_notify (dict_t *dict) { @@ -1710,7 +1751,8 @@ glusterfs_rebalance_event_notify (dict_t *dict) } ret = mgmt_submit_request (&req, frame, ctx, &clnt_handshake_prog, - GF_HNDSK_EVENT_NOTIFY, NULL, + GF_HNDSK_EVENT_NOTIFY, + glusterfs_rebalance_event_notify_cbk, (xdrproc_t)xdr_gf_event_notify_req); if (req.dict.dict_val) -- cgit