diff options
-rw-r--r-- | cli/src/cli-cmd.c | 4 | ||||
-rw-r--r-- | cli/src/cli-cmd.h | 2 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 87 | ||||
-rw-r--r-- | cli/src/cli.c | 8 | ||||
-rw-r--r-- | cli/src/cli.h | 2 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 40 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 57 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handshake.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 15 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 47 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 5 |
14 files changed, 212 insertions, 107 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index 1d98ecc7a36..2b5b8f20dc7 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -365,7 +365,7 @@ cli_cmd_submit (void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, cli_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn) + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc) { int ret = -1; @@ -373,7 +373,7 @@ cli_cmd_submit (void *req, call_frame_t *frame, cmd_sent = 0; ret = cli_submit_request (req, frame, prog, procnum, NULL, sfunc, - this, cbkfn); + this, cbkfn, xdrproc); if (!ret) { cmd_sent = 1; diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h index acb40017a5b..cc6c11c4747 100644 --- a/cli/src/cli-cmd.h +++ b/cli/src/cli-cmd.h @@ -84,7 +84,7 @@ cli_cmd_submit (void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, cli_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn); + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); gf_answer_t cli_cmd_get_confirmation (struct cli_state *state, const char *question); diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 1782b9bac8f..cec85dad748 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1601,7 +1601,8 @@ gf_cli3_1_probe (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_PROBE, NULL, gf_xdr_from_cli_probe_req, - this, gf_cli3_1_probe_cbk); + this, gf_cli3_1_probe_cbk, + (xdrproc_t)xdr_gf1_cli_probe_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1638,7 +1639,8 @@ gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_DEPROBE, NULL, gf_xdr_from_cli_deprobe_req, - this, gf_cli3_1_deprobe_cbk); + this, gf_cli3_1_deprobe_cbk, + (xdrproc_t)xdr_gf1_cli_deprobe_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1662,7 +1664,8 @@ gf_cli3_1_list_friends (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_LIST_FRIENDS, NULL, gf_xdr_from_cli_peer_list_req, - this, gf_cli3_1_list_friends_cbk); + this, gf_cli3_1_list_friends_cbk, + (xdrproc_t) xdr_gf1_cli_peer_list_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1741,7 +1744,8 @@ gf_cli3_1_get_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_GET_VOLUME, NULL, gf_xdr_from_cli_get_vol_req, - this, gf_cli3_1_get_volume_cbk); + this, gf_cli3_1_get_volume_cbk, + (xdrproc_t) xdr_gf1_cli_get_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1798,7 +1802,8 @@ gf_cli3_1_create_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_CREATE_VOLUME, NULL, gf_xdr_from_cli_create_vol_req, - this, gf_cli3_1_create_volume_cbk); + this, gf_cli3_1_create_volume_cbk, + (xdrproc_t) xdr_gf1_cli_create_vol_req); @@ -1840,7 +1845,8 @@ gf_cli3_1_delete_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_DELETE_VOLUME, NULL, gf_xdr_from_cli_delete_vol_req, - this, gf_cli3_1_delete_volume_cbk); + this, gf_cli3_1_delete_volume_cbk, + (xdrproc_t)xdr_gf1_cli_delete_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1873,7 +1879,8 @@ gf_cli3_1_start_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (req, frame, cli_rpc_prog, GLUSTER_CLI_START_VOLUME, NULL, gf_xdr_from_cli_start_vol_req, - this, gf_cli3_1_start_volume_cbk); + this, gf_cli3_1_start_volume_cbk, + (xdrproc_t) xdr_gf1_cli_start_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1906,7 +1913,8 @@ gf_cli3_1_stop_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_STOP_VOLUME, NULL, gf_xdr_from_cli_stop_vol_req, - this, gf_cli3_1_stop_volume_cbk); + this, gf_cli3_1_stop_volume_cbk, + (xdrproc_t) xdr_gf1_cli_stop_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -1980,7 +1988,8 @@ done: ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_DEFRAG_VOLUME, NULL, gf_xdr_from_cli_defrag_vol_req, - this, gf_cli3_1_defrag_volume_cbk); + this, gf_cli3_1_defrag_volume_cbk, + (xdrproc_t) xdr_gf1_cli_defrag_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2016,7 +2025,8 @@ gf_cli3_1_rename_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_RENAME_VOLUME, NULL, gf_xdr_from_cli_rename_vol_req, - this, gf_cli3_1_rename_volume_cbk); + this, gf_cli3_1_rename_volume_cbk, + (xdrproc_t) xdr_gf1_cli_rename_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2053,11 +2063,11 @@ gf_cli3_1_reset_volume (call_frame_t *frame, xlator_t *this, goto out; } - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_RESET_VOLUME, NULL, gf_xdr_from_cli_reset_vol_req, - this, gf_cli3_1_reset_volume_cbk); + this, gf_cli3_1_reset_volume_cbk, + (xdrproc_t) xdr_gf1_cli_reset_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2094,11 +2104,11 @@ gf_cli3_1_set_volume (call_frame_t *frame, xlator_t *this, goto out; } - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_SET_VOLUME, NULL, gf_xdr_from_cli_set_vol_req, - this, gf_cli3_1_set_volume_cbk); + this, gf_cli3_1_set_volume_cbk, + (xdrproc_t) xdr_gf1_cli_set_vol_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2143,7 +2153,8 @@ gf_cli3_1_add_brick (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_ADD_BRICK, NULL, gf_xdr_from_cli_add_brick_req, - this, gf_cli3_1_add_brick_cbk); + this, gf_cli3_1_add_brick_cbk, + (xdrproc_t) xdr_gf1_cli_add_brick_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2192,7 +2203,8 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_REMOVE_BRICK, NULL, gf_xdr_from_cli_remove_brick_req, - this, gf_cli3_1_remove_brick_cbk); + this, gf_cli3_1_remove_brick_cbk, + (xdrproc_t) xdr_gf1_cli_remove_brick_req); out: @@ -2287,7 +2299,8 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_REPLACE_BRICK, NULL, gf_xdr_from_cli_replace_brick_req, - this, gf_cli3_1_replace_brick_cbk); + this, gf_cli3_1_replace_brick_cbk, + (xdrproc_t) xdr_gf1_cli_replace_brick_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2329,7 +2342,8 @@ gf_cli3_1_log_filename (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_LOG_FILENAME, NULL, gf_xdr_from_cli_log_filename_req, - this, gf_cli3_1_log_filename_cbk); + this, gf_cli3_1_log_filename_cbk, + (xdrproc_t) xdr_gf1_cli_log_filename_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2398,7 +2412,8 @@ gf_cli3_1_log_level (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_LOG_LEVEL, NULL, gf_xdr_from_cli_log_level_req, - this, gf_cli3_1_log_level_cbk); + this, gf_cli3_1_log_level_cbk, + (xdrproc_t) xdr_gf1_cli_log_level_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning: %d", ret); @@ -2432,7 +2447,8 @@ gf_cli3_1_log_locate (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_LOG_LOCATE, NULL, gf_xdr_from_cli_log_locate_req, - this, gf_cli3_1_log_locate_cbk); + this, gf_cli3_1_log_locate_cbk, + (xdrproc_t) xdr_gf1_cli_log_locate_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2466,7 +2482,8 @@ gf_cli3_1_log_rotate (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_LOG_ROTATE, NULL, gf_xdr_from_cli_log_rotate_req, - this, gf_cli3_1_log_rotate_cbk); + this, gf_cli3_1_log_rotate_cbk, + (xdrproc_t) xdr_gf1_cli_log_rotate_req); out: @@ -2489,7 +2506,8 @@ gf_cli3_1_sync_volume (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit ((gf1_cli_sync_volume_req*)data, frame, cli_rpc_prog, GLUSTER_CLI_SYNC_VOLUME, NULL, gf_xdr_from_cli_sync_volume_req, - this, gf_cli3_1_sync_volume_cbk); + this, gf_cli3_1_sync_volume_cbk, + (xdrproc_t) xdr_gf1_cli_sync_volume_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2519,7 +2537,8 @@ gf_cli3_1_getspec (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, &cli_handshake_prog, GF_HNDSK_GETSPEC, NULL, xdr_from_getspec_req, - this, gf_cli3_1_getspec_cbk); + this, gf_cli3_1_getspec_cbk, + (xdrproc_t) xdr_gf_getspec_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2556,11 +2575,11 @@ gf_cli3_1_quota (call_frame_t *frame, xlator_t *this, goto out; } - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_QUOTA, NULL, gf_xdr_from_cli_quota_req, - this, gf_cli3_1_quota_cbk); + this, gf_cli3_1_quota_cbk, + (xdrproc_t) xdr_gf1_cli_quota_req); GF_FREE (req.dict.dict_val); out: @@ -2588,7 +2607,8 @@ gf_cli3_1_pmap_b2p (call_frame_t *frame, xlator_t *this, void *data) ret = cli_cmd_submit (&req, frame, &cli_pmap_prog, GF_PMAP_PORTBYBRICK, NULL, xdr_from_pmap_port_by_brick_req, - this, gf_cli3_1_pmap_b2p_cbk); + this, gf_cli3_1_pmap_b2p_cbk, + (xdrproc_t) xdr_pmap_port_by_brick_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2702,7 +2722,8 @@ gf_cli3_1_fsm_log (call_frame_t *frame, xlator_t *this, void *data) ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_FSM_LOG, NULL, gf_xdr_from_cli_fsm_log_req, - this, gf_cli3_1_fsm_log_cbk); + this, gf_cli3_1_fsm_log_cbk, + (xdrproc_t) xdr_gf1_cli_fsm_log_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -2917,7 +2938,8 @@ gf_cli3_1_gsync_set (call_frame_t *frame, xlator_t *this, ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_GSYNC_SET, NULL, gf_xdr_from_cli_gsync_set_req, - this, gf_cli3_1_gsync_set_cbk); + this, gf_cli3_1_gsync_set_cbk, + (xdrproc_t) xdr_gf1_cli_gsync_set_req); out: return ret; @@ -3263,7 +3285,8 @@ gf_cli3_1_profile_volume (call_frame_t *frame, xlator_t *this, void *data) ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_PROFILE_VOLUME, NULL, gf_xdr_from_cli_stats_volume_req, - this, gf_cli3_1_profile_volume_cbk); + this, gf_cli3_1_profile_volume_cbk, + (xdrproc_t) xdr_gf1_cli_stats_volume_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -3478,7 +3501,8 @@ gf_cli3_1_top_volume (call_frame_t *frame, xlator_t *this, void *data) ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_PROFILE_VOLUME, NULL, gf_xdr_from_cli_stats_volume_req, - this, gf_cli3_1_top_volume_cbk); + this, gf_cli3_1_top_volume_cbk, + (xdrproc_t) xdr_gf1_cli_stats_volume_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); @@ -3529,7 +3553,8 @@ gf_cli3_1_getwd (call_frame_t *frame, xlator_t *this, void *data) ret = cli_cmd_submit (&req, frame, cli_rpc_prog, GLUSTER_CLI_GETWD, NULL, gf_xdr_from_cli_getwd_req, - this, gf_cli3_1_getwd_cbk); + this, gf_cli3_1_getwd_cbk, + (xdrproc_t) xdr_gf1_cli_getwd_req); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); diff --git a/cli/src/cli.c b/cli/src/cli.c index 8a06c8abd76..0e904a15e45 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -266,7 +266,7 @@ cli_submit_request (void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, cli_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn) + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc) { int ret = -1; int count = 0; @@ -274,10 +274,12 @@ cli_submit_request (void *req, call_frame_t *frame, struct iovec iov = {0, }; struct iobuf *iobuf = NULL; char new_iobref = 0; + ssize_t xdr_size = 0; GF_ASSERT (this); - iobuf = iobuf_get (this->ctx->iobuf_pool); + xdr_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); if (!iobuf) { goto out; }; @@ -294,7 +296,7 @@ cli_submit_request (void *req, call_frame_t *frame, iobref_add (iobref, iobuf); iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; + iov.iov_len = iobuf_size (iobuf); /* Create the xdr payload */ diff --git a/cli/src/cli.h b/cli/src/cli.h index ae4ebe7d99a..8919390b1da 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -182,7 +182,7 @@ cli_submit_request (void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, cli_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn); + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); int32_t cli_cmd_volume_create_parse (const char **words, int wordcount, diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index dea7d56b11c..f389f1fa3fc 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -68,15 +68,18 @@ mgmt_cbk_spec (void *data) struct iobuf * glusterfs_serialize_reply (rpcsvc_request_t *req, void *arg, - gf_serialize_t sfunc, struct iovec *outmsg) + gf_serialize_t sfunc, struct iovec *outmsg, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; ssize_t retlen = -1; + ssize_t xdr_size = 0; /* First, get the io buffer into which the reply in arg will * be serialized. */ - iob = iobuf_get (req->svc->ctx->iobuf_pool); + xdr_size = xdr_sizeof (xdrproc, arg); + iob = iobuf_get2 (req->svc->ctx->iobuf_pool, xdr_size); if (!iob) { gf_log (THIS->name, GF_LOG_ERROR, "Failed to get iobuf"); goto ret; @@ -108,7 +111,8 @@ ret: int glusterfs_submit_reply (rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gf_serialize_t sfunc) + struct iobref *iobref, gf_serialize_t sfunc, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; int ret = -1; @@ -131,7 +135,7 @@ glusterfs_submit_reply (rpcsvc_request_t *req, void *arg, new_iobref = 1; } - iob = glusterfs_serialize_reply (req, arg, sfunc, &rsp); + iob = glusterfs_serialize_reply (req, arg, sfunc, &rsp, xdrproc); if (!iob) { gf_log (THIS->name, GF_LOG_ERROR, "Failed to serialize reply"); goto out; @@ -181,7 +185,8 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret) if (ret == 0) ret = glusterfs_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_brick_op_rsp); + gd_xdr_serialize_mgmt_brick_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_brick_op_rsp); if (rsp.output.output_val) GF_FREE (rsp.output.output_val); @@ -247,7 +252,8 @@ glusterfs_translator_info_response_send (rpcsvc_request_t *req, int ret, (size_t *)&rsp.output.output_len); ret = glusterfs_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_brick_op_rsp); + gd_xdr_serialize_mgmt_brick_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_brick_op_rsp); if (rsp.output.output_val) GF_FREE (rsp.output.output_val); return ret; @@ -398,20 +404,24 @@ int mgmt_submit_request (void *req, call_frame_t *frame, glusterfs_ctx_t *ctx, rpc_clnt_prog_t *prog, int procnum, - mgmt_serialize_t sfunc, fop_cbk_fn_t cbkfn) + mgmt_serialize_t sfunc, fop_cbk_fn_t cbkfn, + xdrproc_t xdrproc) { int ret = -1; int count = 0; struct iovec iov = {0, }; struct iobuf *iobuf = NULL; struct iobref *iobref = NULL; + ssize_t xdr_size = 0; iobref = iobref_new (); if (!iobref) { goto out; } - iobuf = iobuf_get (ctx->iobuf_pool); + xdr_size = xdr_sizeof (xdrproc, req); + + iobuf = iobuf_get2 (ctx->iobuf_pool, xdr_size); if (!iobuf) { goto out; }; @@ -419,7 +429,7 @@ mgmt_submit_request (void *req, call_frame_t *frame, iobref_add (iobref, iobuf); iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; + iov.iov_len = iobuf_pagesize (iobuf); /* Create the xdr payload */ @@ -718,7 +728,8 @@ glusterfs_volfile_fetch (glusterfs_ctx_t *ctx) ret = mgmt_submit_request (&req, frame, ctx, &clnt_handshake_prog, GF_HNDSK_GETSPEC, xdr_from_getspec_req, - mgmt_getspec_cbk); + mgmt_getspec_cbk, + (xdrproc_t)xdr_gf_getspec_req); return ret; } @@ -983,7 +994,8 @@ mgmt_pmap_signin_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = mgmt_submit_request (&pmap_req, frame, ctx, &clnt_pmap_prog, GF_PMAP_SIGNIN, xdr_from_pmap_signin_req, - mgmt_pmap_signin2_cbk); + mgmt_pmap_signin2_cbk, + (xdrproc_t)xdr_pmap_signin_req); if (ret) goto out; @@ -1017,7 +1029,8 @@ glusterfs_mgmt_pmap_signin (glusterfs_ctx_t *ctx) ret = mgmt_submit_request (&req, frame, ctx, &clnt_pmap_prog, GF_PMAP_SIGNIN, xdr_from_pmap_signin_req, - mgmt_pmap_signin_cbk); + mgmt_pmap_signin_cbk, + (xdrproc_t)xdr_pmap_signin_req); out: return ret; @@ -1084,7 +1097,8 @@ glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx) ret = mgmt_submit_request (&req, frame, ctx, &clnt_pmap_prog, GF_PMAP_SIGNOUT, xdr_from_pmap_signout_req, - mgmt_pmap_signout_cbk); + mgmt_pmap_signout_cbk, + (xdrproc_t)xdr_pmap_signout_req); out: return ret; } diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 51d51bc9e85..2b6aae081cc 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1481,14 +1481,6 @@ __socket_proto_state_machine (rpc_transport_t *this, switch (priv->incoming.record_state) { case SP_STATE_NADA: - iobuf = iobuf_get (this->ctx->iobuf_pool); - if (!iobuf) { - ret = -ENOMEM; - goto out; - } - - priv->incoming.iobuf = iobuf; - priv->incoming.iobuf_size = 0; priv->incoming.total_bytes_read = 0; priv->incoming.payload_vector.iov_len = 0; @@ -1496,7 +1488,6 @@ __socket_proto_state_machine (rpc_transport_t *this, priv->incoming.pending_vector->iov_base = &priv->incoming.fraghdr; - priv->incoming.frag.fragcurrent = iobuf_ptr (iobuf); priv->incoming.pending_vector->iov_len = sizeof (priv->incoming.fraghdr); @@ -1540,6 +1531,17 @@ __socket_proto_state_machine (rpc_transport_t *this, priv->incoming.record_state = SP_STATE_READING_FRAG; priv->incoming.total_bytes_read += RPC_FRAGSIZE(priv->incoming.fraghdr); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, + priv->incoming.total_bytes_read + + sizeof (priv->incoming.fraghdr)); + if (!iobuf) { + ret = -ENOMEM; + goto out; + } + + priv->incoming.iobuf = iobuf; + priv->incoming.iobuf_size = 0; + priv->incoming.frag.fragcurrent = iobuf_ptr (iobuf); /* fall through */ case SP_STATE_READING_FRAG: diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 1cc27d925ef..e18bce61884 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1030,7 +1030,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_create_vol_rsp); + gf_xdr_serialize_cli_create_vol_rsp, + (xdrproc_t)xdr_gf1_cli_create_vol_rsp); if (!lock_fail) (void) glusterd_opinfo_unlock (); @@ -1454,7 +1455,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_add_brick_rsp); + gf_xdr_serialize_cli_add_brick_rsp, + (xdrproc_t)xdr_gf1_cli_add_brick_rsp); if (!lock_fail) glusterd_opinfo_unlock(); ret = 0; //sent error to cli, prevent second reply @@ -2169,7 +2171,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_remove_brick_rsp); + gf_xdr_serialize_cli_remove_brick_rsp, + (xdrproc_t)xdr_gf1_cli_remove_brick_rsp); if (!lock_fail) glusterd_opinfo_unlock(); @@ -2352,7 +2355,8 @@ out: rsp.path = "Operation failed"; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_log_locate_rsp); + gf_xdr_serialize_cli_log_locate_rsp, + (xdrproc_t)xdr_gf1_cli_log_locate_rsp); if (cli_req.brick) free (cli_req.brick); //its malloced by xdr @@ -2594,7 +2598,8 @@ out: if (msg[0] == '\0') snprintf (msg, sizeof (msg), "Operation failed"); glusterd_submit_reply(req, &cli_rsp, NULL, 0, NULL, - gf_xdr_from_cli_sync_volume_rsp); + gf_xdr_from_cli_sync_volume_rsp, + (xdrproc_t)xdr_gf1_cli_sync_volume_rsp); if (free_hostname && cli_req.hostname) free (cli_req.hostname); if (free_volname && cli_req.volname) @@ -2632,7 +2637,8 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret, (size_t *)&rsp.fsm_log.fsm_log_len); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_from_cli_fsm_log_rsp); + gf_xdr_from_cli_fsm_log_rsp, + (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); if (rsp.fsm_log.fsm_log_val) GF_FREE (rsp.fsm_log.fsm_log_val); @@ -2709,7 +2715,8 @@ glusterd_op_lock_send_resp (rpcsvc_request_t *req, int32_t status) rsp.op_ret = status; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_cluster_lock_rsp); + gd_xdr_serialize_mgmt_cluster_lock_rsp, + (xdrproc_t)xdr_gd1_mgmt_cluster_lock_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded, ret: %d", ret); @@ -2729,7 +2736,8 @@ glusterd_op_unlock_send_resp (rpcsvc_request_t *req, int32_t status) glusterd_get_uuid (&rsp.uuid); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_cluster_unlock_rsp); + gd_xdr_serialize_mgmt_cluster_unlock_rsp, + (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to unlock, ret: %d", ret); @@ -2801,7 +2809,8 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req, } ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_stage_op_rsp); + gd_xdr_serialize_mgmt_stage_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_stage_op_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to stage, ret: %d", ret); @@ -2842,7 +2851,8 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req, ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_commit_op_rsp); + gd_xdr_serialize_mgmt_commit_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_commit_op_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to commit, ret: %d", ret); @@ -3089,7 +3099,8 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) out: uuid_copy (rsp.uuid, priv->uuid); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_update_rsp); + gd_xdr_serialize_mgmt_friend_update_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_update_rsp); if (dict) { if (!dict->extra_stdfree && friend_req.friends.friends_val) free (friend_req.friends.friends_val);//malloced by xdr @@ -3167,7 +3178,8 @@ glusterd_handle_probe_query (rpcsvc_request_t *req) rsp.hostname = probe_req.hostname; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_probe_rsp); + gd_xdr_serialize_mgmt_probe_rsp, + (xdrproc_t)xdr_gd1_mgmt_probe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s, op_ret: %d, " "op_errno: %d, ret: %d", probe_req.hostname, @@ -3292,7 +3304,8 @@ glusterd_handle_getwd (rpcsvc_request_t *req) rsp.wd = priv->workdir; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_from_cli_getwd_rsp); + gf_xdr_from_cli_getwd_rsp, + (xdrproc_t)xdr_gf1_cli_getwd_rsp); glusterd_friend_sm (); glusterd_op_sm (); @@ -3604,7 +3617,8 @@ glusterd_xfer_friend_remove_resp (rpcsvc_request_t *req, char *hostname, int por rsp.hostname = hostname; rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_rsp); + gd_xdr_serialize_mgmt_friend_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s (%d), ret: %d", hostname, port, ret); @@ -3635,7 +3649,8 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port, rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_rsp); + gd_xdr_serialize_mgmt_friend_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s (%d), ret: %d", hostname, port, ret); @@ -3659,7 +3674,8 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret, rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_probe_rsp); + gf_xdr_serialize_cli_probe_rsp, + (xdrproc_t)xdr_gf1_cli_probe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to CLI, ret: %d",ret); @@ -3680,7 +3696,8 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, rsp.hostname = hostname; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_deprobe_rsp); + gf_xdr_serialize_cli_deprobe_rsp, + (xdrproc_t)xdr_gf1_cli_deprobe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to CLI, ret: %d",ret); @@ -3742,7 +3759,8 @@ out: rsp.op_ret = ret; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_peer_list_rsp); + gf_xdr_serialize_cli_peer_list_rsp, + (xdrproc_t)xdr_gf1_cli_peer_list_rsp); if (rsp.friends.friends_val) GF_FREE (rsp.friends.friends_val); @@ -3845,7 +3863,8 @@ out: rsp.op_ret = ret; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_peer_list_rsp); + gf_xdr_serialize_cli_peer_list_rsp, + (xdrproc_t)xdr_gf1_cli_peer_list_rsp); if (volumes) dict_unref (volumes); diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index dda8a03bb12..8a7424c0dfe 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -191,7 +191,8 @@ fail: rsp.spec = ""; glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_serialize_getspec_rsp); + (gd_serialize_t)xdr_serialize_getspec_rsp, + (xdrproc_t)xdr_gf_getspec_rsp); if (args.key) free (args.key);//malloced by xdr if (rsp.spec && (strcmp (rsp.spec, ""))) @@ -421,7 +422,8 @@ glusterd_peer_handshake (xlator_t *this, struct rpc_clnt *rpc, ret = glusterd_submit_request (peerctx->peerinfo->rpc, &req, frame, &glusterd_dump_prog, GF_DUMP_DUMP, NULL, xdr_from_dump_req, this, - glusterd_peer_dump_version_cbk); + glusterd_peer_dump_version_cbk, + (xdrproc_t)xdr_gf_dump_req); out: return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index f1f49fc60b1..d1a4e9fafa1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -335,7 +335,8 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_port_by_brick_rsp); + (gd_serialize_t)xdr_from_pmap_port_by_brick_rsp, + (xdrproc_t)xdr_pmap_port_by_brick_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -362,7 +363,8 @@ gluster_pmap_brickbyport (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_brick_by_port_rsp); + (gd_serialize_t)xdr_from_pmap_brick_by_port_rsp, + (xdrproc_t)xdr_pmap_brick_by_port_rsp); return 0; } @@ -393,7 +395,8 @@ gluster_pmap_signup (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signup_rsp); + (gd_serialize_t)xdr_from_pmap_signup_rsp, + (xdrproc_t)xdr_pmap_signup_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -420,7 +423,8 @@ gluster_pmap_signin (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signin_rsp); + (gd_serialize_t)xdr_from_pmap_signin_rsp, + (xdrproc_t)xdr_pmap_signin_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -453,7 +457,8 @@ gluster_pmap_signout (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signout_rsp); + (gd_serialize_t)xdr_from_pmap_signout_rsp, + (xdrproc_t)xdr_pmap_signout_rsp); if (args.brick) free (args.brick);//malloced by xdr diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 168f504446c..f21222f8855 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -615,7 +615,8 @@ glusterd_handle_defrag_volume_v2 (rpcsvc_request_t *req) out: ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_defrag_vol_rsp_v2); + gf_xdr_serialize_cli_defrag_vol_rsp_v2, + (xdrproc_t)xdr_gf2_cli_defrag_vol_rsp); if (cli_req.volname) free (cli_req.volname);//malloced by xdr @@ -685,7 +686,8 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req) out: ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_defrag_vol_rsp); + gf_xdr_serialize_cli_defrag_vol_rsp, + (xdrproc_t)xdr_gf1_cli_defrag_vol_rsp); if (cli_req.volname) free (cli_req.volname);//malloced by xdr diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index b7d800ffcdc..29239b324be 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -57,6 +57,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, dict_t *ctx = NULL; char *free_ptr = NULL; glusterd_conf_t *conf = NULL; + xdrproc_t xdrproc; GF_ASSERT (THIS); @@ -77,6 +78,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_create_vol_rsp; + xdrproc = (xdrproc_t)xdr_gf1_cli_create_vol_rsp; break; } @@ -92,6 +94,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_start_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_start_vol_rsp; break; } @@ -107,6 +110,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_stop_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_stop_vol_rsp; break; } @@ -122,6 +126,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_delete_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_delete_vol_rsp; break; } @@ -133,6 +138,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, //rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_defrag_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_defrag_vol_rsp; break; } @@ -148,6 +154,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_add_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_add_brick_rsp; break; } @@ -163,6 +170,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_remove_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_remove_brick_rsp; break; } @@ -182,6 +190,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_replace_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_replace_brick_rsp; break; } @@ -207,6 +216,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_set_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_set_vol_rsp; break; } @@ -223,6 +233,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = "Error while resetting options"; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_reset_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_reset_vol_rsp; break; } @@ -237,6 +248,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_filename_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_filename_rsp; break; } case GD_OP_LOG_ROTATE: @@ -250,6 +262,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_rotate_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_rotate_rsp; break; } case GD_OP_SYNC_VOLUME: @@ -263,6 +276,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_from_cli_sync_volume_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_sync_volume_rsp; break; } case GD_OP_GSYNC_SET: @@ -297,6 +311,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = op_errstr; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_gsync_set_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_gsync_set_rsp; break; } case GD_OP_RENAME_VOLUME: @@ -323,6 +338,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, free_ptr = rsp.stats_info.stats_info_val; cli_rsp = &rsp; sfunc = gf_xdr_from_cli_stats_volume_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_stats_volume_rsp; break; } @@ -371,6 +387,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, } cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_quota_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_quota_rsp; break; } @@ -386,6 +403,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_level_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_level_rsp; break; } @@ -398,7 +416,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, } ret = glusterd_submit_reply (req, cli_rsp, NULL, 0, NULL, - sfunc); + sfunc, xdrproc); if (free_ptr) GF_FREE (free_ptr); @@ -1374,7 +1392,8 @@ glusterd3_1_probe (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_PROBE_QUERY, NULL, gd_xdr_from_mgmt_probe_req, - this, glusterd3_1_probe_cbk); + this, glusterd3_1_probe_cbk, + (xdrproc_t)xdr_gd1_mgmt_probe_req); out: if (req.hostname) @@ -1427,7 +1446,8 @@ glusterd3_1_friend_add (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_FRIEND_ADD, NULL, gd_xdr_from_mgmt_friend_req, - this, glusterd3_1_friend_add_cbk); + this, glusterd3_1_friend_add_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_req); out: @@ -1469,7 +1489,8 @@ glusterd3_1_friend_remove (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_FRIEND_REMOVE, NULL, gd_xdr_from_mgmt_friend_req, - this, glusterd3_1_friend_remove_cbk); + this, glusterd3_1_friend_remove_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); @@ -1515,7 +1536,8 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_FRIEND_UPDATE, NULL, gd_xdr_from_mgmt_friend_update, - this, glusterd3_1_friend_update_cbk); + this, glusterd3_1_friend_update_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_update); out: if (req.friends.friends_val) @@ -1553,7 +1575,8 @@ glusterd3_1_cluster_lock (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_CLUSTER_LOCK, NULL, gd_xdr_from_mgmt_cluster_lock_req, - this, glusterd3_1_cluster_lock_cbk); + this, glusterd3_1_cluster_lock_cbk, + (xdrproc_t)xdr_gd1_mgmt_cluster_lock_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1587,7 +1610,8 @@ glusterd3_1_cluster_unlock (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_CLUSTER_UNLOCK, NULL, gd_xdr_from_mgmt_cluster_unlock_req, - this, glusterd3_1_cluster_unlock_cbk); + this, glusterd3_1_cluster_unlock_cbk, + (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1646,7 +1670,8 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_STAGE_OP, NULL, gd_xdr_from_mgmt_stage_op_req, - this, glusterd3_1_stage_op_cbk); + this, glusterd3_1_stage_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_stage_op_req); out: if ((_gf_true == is_alloc) && req.buf.buf_val) @@ -1708,7 +1733,8 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_COMMIT_OP, NULL, gd_xdr_from_mgmt_commit_op_req, - this, glusterd3_1_commit_op_cbk); + this, glusterd3_1_commit_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_commit_op_req); out: if ((_gf_true == is_alloc) && req.buf.buf_val) @@ -1937,7 +1963,8 @@ glusterd3_1_brick_op (call_frame_t *frame, xlator_t *this, &glusterd_glusterfs_3_1_mgmt_prog, req->op, NULL, gd_xdr_from_mgmt_brick_op_req, - this, glusterd3_1_brick_op_cbk); + this, glusterd3_1_brick_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_brick_op_req); if (req) { if (req->input.input_val) GF_FREE (req->input.input_val); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 56e03e6624b..73c9ffb029f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -307,18 +307,20 @@ glusterd_submit_request (struct rpc_clnt *rpc, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, gd_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn) + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc) { int ret = -1; struct iobuf *iobuf = NULL; int count = 0; char new_iobref = 0, start_ping = 0; struct iovec iov = {0, }; + ssize_t req_size = 0; GF_ASSERT (rpc); GF_ASSERT (this); - iobuf = iobuf_get (this->ctx->iobuf_pool); + req_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, req_size); if (!iobuf) { goto out; }; @@ -335,7 +337,7 @@ glusterd_submit_request (struct rpc_clnt *rpc, void *req, iobref_add (iobref, iobuf); iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; + iov.iov_len = iobuf_pagesize (iobuf); /* Create the xdr payload */ if (req && sfunc) { @@ -377,15 +379,18 @@ out: struct iobuf * glusterd_serialize_reply (rpcsvc_request_t *req, void *arg, - gd_serialize_t sfunc, struct iovec *outmsg) + gd_serialize_t sfunc, struct iovec *outmsg, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; ssize_t retlen = -1; + ssize_t rsp_size = 0; /* First, get the io buffer into which the reply in arg will * be serialized. */ - iob = iobuf_get (req->svc->ctx->iobuf_pool); + rsp_size = xdr_sizeof (xdrproc, arg); + iob = iobuf_get2 (req->svc->ctx->iobuf_pool, rsp_size); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to get iobuf"); goto ret; @@ -417,7 +422,8 @@ ret: int glusterd_submit_reply (rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gd_serialize_t sfunc) + struct iobref *iobref, gd_serialize_t sfunc, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; int ret = -1; @@ -440,7 +446,7 @@ glusterd_submit_reply (rpcsvc_request_t *req, void *arg, new_iobref = 1; } - iob = glusterd_serialize_reply (req, arg, sfunc, &rsp); + iob = glusterd_serialize_reply (req, arg, sfunc, &rsp, xdrproc); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to serialize reply"); } else { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 254557c27ec..760bb6b9770 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -69,14 +69,15 @@ glusterd_get_uuid (uuid_t *uuid); int glusterd_submit_reply (rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gd_serialize_t sfunc); + struct iobref *iobref, gd_serialize_t sfunc, + xdrproc_t xdrproc); int glusterd_submit_request (struct rpc_clnt *rpc, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, gd_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn); + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); int32_t glusterd_volinfo_new (glusterd_volinfo_t **volinfo); |