diff options
author | Amar Tumballi <amarts@redhat.com> | 2019-04-20 11:55:12 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-04-29 05:29:44 +0000 |
commit | 48d160756813875cf1889b4ce96493d25f96c726 (patch) | |
tree | 92349106820659f831f295e214335a0297a4ba48 /xlators/protocol/server/src/server-rpc-fops_v2.c | |
parent | 88418f400507fba109971f169ce0a2c4243a31c9 (diff) |
protocol: remove compound fop
Compound fops are kept on wire as a backward compatibility with
older AFR modules. The AFR module used beyond 4.x releases are
not using compound fops. Hence removing the compound fop in the
protocol code.
Note that, compound-fops was already an 'option' in AFR, and
completely removed since 4.1.x releases.
So, point to note is, with this change, we have 2 ways to upgrade
when clients of 3.x series are present.
i) set 'use-compound-fops' option to 'false' on any volume which
is of replica type. And then upgrade the servers.
ii) Do a two step upgrade. First from current version (which will
already be EOL if it's using compound) to a 4.1..6.x version,
and then an upgrade to 7.x.
Consider the overall code which we are removing for the option
seems quite high, I believe it is worth it.
updates: bz#1693692
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Change-Id: I0a8876d0367a15e1410ec845f251d5d3097ee593
Diffstat (limited to 'xlators/protocol/server/src/server-rpc-fops_v2.c')
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops_v2.c | 185 |
1 files changed, 1 insertions, 184 deletions
diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c index cb0e2474e0e..fa5db087a08 100644 --- a/xlators/protocol/server/src/server-rpc-fops_v2.c +++ b/xlators/protocol/server/src/server-rpc-fops_v2.c @@ -21,7 +21,6 @@ #include <glusterfs/default-args.h> #include "server-common.h" #include <glusterfs/xlator.h> -#include <glusterfs/compound-fop-utils.h> #include "xdr-nfs3.h" @@ -5958,192 +5957,10 @@ out: } int -server4_compound_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, void *data, - dict_t *xdata) -{ - struct gfx_compound_rsp rsp = { - 0, - }; - server_state_t *state = NULL; - rpcsvc_request_t *req = NULL; - compound_args_cbk_t *args_cbk = data; - int i = 0; - - req = frame->local; - state = CALL_STATE(frame); - - dict_to_xdr(xdata, &rsp.xdata); - - if (op_ret) { - gf_msg(this->name, fop_log_level(GF_FOP_COMPOUND, op_errno), op_errno, - PS_MSG_COMPOUND_INFO, - "%" PRId64 ": COMPOUND%" PRId64 - " (%s), client: %s, " - "error-xlator: %s", - frame->root->unique, state->resolve.fd_no, - uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root), - STACK_ERR_XL_NAME(frame->root)); - } - - /* TODO: I assume a single 10MB payload is large, if not, we need to - agree to valid payload */ - if (!args_cbk) { - op_ret = -1; - goto out; - } - - if ((args_cbk->fop_length <= 0) || - ((args_cbk->fop_length > (10 * 1024 * 1024)))) { - op_ret = -1; - op_errno = EINVAL; - goto out; - } - - rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC( - args_cbk->fop_length, sizeof(compound_rsp_v2), - gf_server_mt_compound_rsp_t); - - if (!rsp.compound_rsp_array.compound_rsp_array_val) { - op_ret = -1; - op_errno = ENOMEM; - goto out; - } - rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length; - - for (i = 0; i < args_cbk->fop_length; i++) { - op_ret = server_populate_compound_response_v2(this, &rsp, frame, - args_cbk, i); - - if (op_ret) { - op_errno = op_ret; - op_ret = -1; - goto out; - } - } -out: - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error(op_errno); - - server_submit_reply(frame, req, &rsp, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_compound_rsp); - if (args_cbk) - server_compound_rsp_cleanup_v2(&rsp, args_cbk); - GF_FREE(rsp.xdata.pairs.pairs_val); - - return 0; -} - -int -server4_compound_resume(call_frame_t *frame, xlator_t *bound_xl) -{ - server_state_t *state = NULL; - gfx_compound_req *req = NULL; - compound_args_t *args = NULL; - int i = 0; - int ret = -1; - int length = 0; - int op_errno = ENOMEM; - compound_req_v2 *c_req = NULL; - - state = CALL_STATE(frame); - - if (state->resolve.op_ret != 0) { - ret = state->resolve.op_ret; - op_errno = state->resolve.op_errno; - goto err; - } - - req = &state->req_v2; - - length = req->compound_req_array.compound_req_array_len; - state->args = compound_fop_alloc(length, req->compound_fop_enum, - state->xdata); - args = state->args; - - if (!args) - goto err; - - for (i = 0; i < length; i++) { - c_req = &req->compound_req_array.compound_req_array_val[i]; - args->enum_list[i] = c_req->fop_enum; - - ret = server_populate_compound_request_v2(req, frame, - &args->req_list[i], i); - - if (ret) { - op_errno = ret; - ret = -1; - goto err; - } - } - - STACK_WIND(frame, server4_compound_cbk, bound_xl, bound_xl->fops->compound, - args, state->xdata); - - return 0; -err: - server4_compound_cbk(frame, NULL, frame->this, ret, op_errno, NULL, NULL); - - return ret; -} -int server4_0_compound(rpcsvc_request_t *req) { - server_state_t *state = NULL; - call_frame_t *frame = NULL; - gfx_compound_req args = { - 0, - }; - ssize_t len = 0; - int length = 0; - int i = 0; int ret = -1; - - if (!req) - return ret; - - ret = rpc_receive_common(req, &frame, &state, &len, &args, - xdr_gfx_compound_req, GF_FOP_COMPOUND); - if (ret != 0) { - goto out; - } - - state->req_v2 = args; - state->iobref = iobref_ref(req->iobref); - - if (len < req->msg[0].iov_len) { - state->payload_vector[0].iov_base = (req->msg[0].iov_base + len); - state->payload_vector[0].iov_len = req->msg[0].iov_len - len; - state->payload_count = 1; - } - - for (i = 1; i < req->count; i++) { - state->payload_vector[state->payload_count++] = req->msg[i]; - } - - state->size = iov_length(state->payload_vector, state->payload_count); - - ret = server_get_compound_resolve_v2(state, &args); - - if (ret) { - SERVER_REQ_SET_ERROR(req, ret); - goto out; - } - - if (xdr_to_dict(&args.xdata, &state->xdata)) { - SERVER_REQ_SET_ERROR(req, ret); - goto out; - } - - ret = 0; - resolve_and_resume(frame, server4_compound_resume); -out: - - length = args.compound_req_array.compound_req_array_len; - server_compound_req_cleanup_v2(&args, length); - free(args.compound_req_array.compound_req_array_val); - + SERVER_REQ_SET_ERROR(req, ret); return ret; } |