diff options
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 3 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 143 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3.h | 7 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 264 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 67 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops_v2.c | 102 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 65 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops_v2.c | 82 |
8 files changed, 581 insertions, 152 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 7b7866bff7a..8766da47b7b 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -565,7 +565,8 @@ rpcsvc_check_and_reply_error (int ret, call_frame_t *frame, void *opaque) if (ret) gf_log ("rpcsvc", GF_LOG_ERROR, - "rpc actor failed to complete successfully"); + "rpc actor (%d:%d:%d) failed to complete successfully", + req->prognum, req->progver, req->procnum); if (ret == RPCSVC_ACTOR_ERROR) { ret = rpcsvc_error_reply (req); diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 65d0b641333..2713d62d0ae 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -24,6 +24,7 @@ /* ugly #includes below */ #include "protocol-common.h" #include "glusterfs3-xdr.h" +#include "glusterfs4-xdr.h" #include "xdr-nfs3.h" #include "rpcsvc.h" @@ -1716,6 +1717,137 @@ out: return ret; } +static int +__socket_read_accepted_successful_reply_v2 (rpc_transport_t *this) +{ + socket_private_t *priv = NULL; + int ret = 0; + struct iobuf *iobuf = NULL; + gfx_read_rsp read_rsp = {0, }; + ssize_t size = 0; + ssize_t default_read_size = 0; + XDR xdr; + struct gf_sock_incoming *in = NULL; + struct gf_sock_incoming_frag *frag = NULL; + + GF_VALIDATE_OR_GOTO ("socket", this, out); + GF_VALIDATE_OR_GOTO ("socket", this->private, out); + + priv = this->private; + + /* used to reduce the indirection */ + in = &priv->incoming; + frag = &in->frag; + + switch (frag->call_body.reply.accepted_success_state) { + + case SP_STATE_ACCEPTED_SUCCESS_REPLY_INIT: + default_read_size = xdr_sizeof ((xdrproc_t) xdr_gfx_read_rsp, + &read_rsp); + + /* We need to store the current base address because we will + * need it after a partial read. */ + in->proghdr_base_addr = frag->fragcurrent; + + __socket_proto_init_pending (priv, default_read_size); + + frag->call_body.reply.accepted_success_state + = SP_STATE_READING_PROC_HEADER; + + /* fall through */ + + case SP_STATE_READING_PROC_HEADER: + __socket_proto_read (priv, ret); + + /* there can be 'xdata' in read response, figure it out */ + default_read_size = frag->fragcurrent - in->proghdr_base_addr; + + xdrmem_create (&xdr, in->proghdr_base_addr, default_read_size, + XDR_DECODE); + + /* This will fail if there is xdata sent from server, if not, + well and good, we don't need to worry about */ + xdr_gfx_read_rsp (&xdr, &read_rsp); + + free (read_rsp.xdata.pairs.pairs_val); + + /* need to round off to proper roof (%4), as XDR packing pads + the end of opaque object with '0' */ + size = roof (read_rsp.xdata.xdr_size, 4); + + if (!size) { + frag->call_body.reply.accepted_success_state + = SP_STATE_READ_PROC_OPAQUE; + goto read_proc_opaque; + } + + __socket_proto_init_pending (priv, size); + + frag->call_body.reply.accepted_success_state + = SP_STATE_READING_PROC_OPAQUE; + /* fall through */ + + case SP_STATE_READING_PROC_OPAQUE: + __socket_proto_read (priv, ret); + + frag->call_body.reply.accepted_success_state + = SP_STATE_READ_PROC_OPAQUE; + /* fall through */ + + case SP_STATE_READ_PROC_OPAQUE: + read_proc_opaque: + if (in->payload_vector.iov_base == NULL) { + + size = (RPC_FRAGSIZE (in->fraghdr) - frag->bytes_read); + + iobuf = iobuf_get2 (this->ctx->iobuf_pool, size); + if (iobuf == NULL) { + ret = -1; + goto out; + } + + if (in->iobref == NULL) { + in->iobref = iobref_new (); + if (in->iobref == NULL) { + ret = -1; + iobuf_unref (iobuf); + goto out; + } + } + + ret = iobref_add (in->iobref, iobuf); + iobuf_unref (iobuf); + if (ret < 0) { + goto out; + } + + in->payload_vector.iov_base = iobuf_ptr (iobuf); + in->payload_vector.iov_len = size; + } + + frag->fragcurrent = in->payload_vector.iov_base; + + frag->call_body.reply.accepted_success_state + = SP_STATE_READ_PROC_HEADER; + + /* fall through */ + + case SP_STATE_READ_PROC_HEADER: + /* now read the entire remaining msg into new iobuf */ + ret = __socket_read_simple_msg (this); + if ((ret == -1) + || ((ret == 0) && RPC_LASTFRAG (in->fraghdr))) { + frag->call_body.reply.accepted_success_state + = SP_STATE_ACCEPTED_SUCCESS_REPLY_INIT; + } + + break; + } + +out: + return ret; +} + #define rpc_reply_verflen_addr(fragcurrent) ((char *)fragcurrent - 4) #define rpc_reply_accept_status_addr(fragcurrent) ((char *)fragcurrent - 4) @@ -1789,7 +1921,16 @@ __socket_read_accepted_reply (rpc_transport_t *this) if (frag->call_body.reply.accept_status == SUCCESS) { - ret = __socket_read_accepted_successful_reply (this); + /* Need two different methods here for different protocols + Mainly because the exact XDR is used to calculate the + size of response */ + if ((in->request_info->procnum == GFS3_OP_READ) && + (in->request_info->prognum == GLUSTER_FOP_PROGRAM) && + (in->request_info->progver == GLUSTER_FOP_VERSION_v2)) { + ret = __socket_read_accepted_successful_reply_v2 (this); + } else { + ret = __socket_read_accepted_successful_reply (this); + } } else { /* read entire remaining msg into buffer pointed to by * fragcurrent diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index bbe231139b3..550b9a3ceb8 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -668,6 +668,9 @@ dict_to_xdr (dict_t *this, gfx_dict *dict) goto out; } + /* Do the whole operation in locked region */ + LOCK (&this->lock); + dict->pairs.pairs_val = GF_CALLOC (1, (this->count * sizeof (gfx_dict_pair)), gf_common_mt_char); @@ -756,6 +759,10 @@ dict_to_xdr (dict_t *this, gfx_dict *dict) ret = 0; out: + /* this can be null here, so unlock only if its not null */ + if (this) + UNLOCK (&this->lock); + return ret; } diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index fe6e923c077..def95c15cf9 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -655,6 +655,257 @@ protocol_client_reopen (clnt_fd_ctx_t *fdctx, xlator_t *this) protocol_client_reopenfile (fdctx, this); } +/* v4.x + */ +int +client4_0_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, + void *myframe) +{ + int32_t ret = -1; + gfx_open_rsp rsp = {0,}; + clnt_local_t *local = NULL; + clnt_fd_ctx_t *fdctx = NULL; + call_frame_t *frame = NULL; + xlator_t *this = NULL; + + frame = myframe; + this = frame->this; + local = frame->local; + fdctx = local->fdctx; + + if (-1 == req->rpc_status) { + gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN, + PC_MSG_RPC_STATUS_ERROR, "received RPC status error, " + "returning ENOTCONN"); + rsp.op_ret = -1; + rsp.op_errno = ENOTCONN; + goto out; + } + + ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp); + if (ret < 0) { + gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); + rsp.op_ret = -1; + rsp.op_errno = EINVAL; + goto out; + } + + if (rsp.op_ret < 0) { + gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", + local->loc.path); + } else { + gf_msg_debug (frame->this->name, 0, + "reopen on %s succeeded (remote-fd = %"PRId64")", + local->loc.path, rsp.fd); + } + + if (rsp.op_ret == -1) { + ret = -1; + goto out; + } + + ret = 0; + +out: + fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this); + + frame->local = NULL; + STACK_DESTROY (frame->root); + + client_local_wipe (local); + + return 0; +} + +int +client4_0_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count, + void *myframe) +{ + int32_t ret = -1; + gfx_open_rsp rsp = {0,}; + clnt_local_t *local = NULL; + clnt_fd_ctx_t *fdctx = NULL; + call_frame_t *frame = NULL; + + frame = myframe; + local = frame->local; + fdctx = local->fdctx; + + if (-1 == req->rpc_status) { + gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN, + PC_MSG_RPC_STATUS_ERROR, "received RPC status error, " + "returning ENOTCONN"); + rsp.op_ret = -1; + rsp.op_errno = ENOTCONN; + goto out; + } + + ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp); + if (ret < 0) { + gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); + rsp.op_ret = -1; + rsp.op_errno = EINVAL; + goto out; + } + + if (rsp.op_ret < 0) { + gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", + local->loc.path); + } else { + gf_msg (frame->this->name, GF_LOG_INFO, 0, + PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded " + "(fd = %"PRId64")", local->loc.path, rsp.fd); + } + + if (-1 == rsp.op_ret) { + ret = -1; + goto out; + } + +out: + fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this); + + frame->local = NULL; + STACK_DESTROY (frame->root); + client_local_wipe (local); + + return 0; +} + +static int +protocol_client_reopendir_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this) +{ + int ret = -1; + gfx_opendir_req req = {{0,},}; + clnt_local_t *local = NULL; + call_frame_t *frame = NULL; + clnt_conf_t *conf = NULL; + + conf = this->private; + + local = mem_get0 (this->local_pool); + if (!local) { + ret = -1; + goto out; + } + local->fdctx = fdctx; + + gf_uuid_copy (local->loc.gfid, fdctx->gfid); + ret = loc_path (&local->loc, NULL); + if (ret < 0) + goto out; + + frame = create_frame (this, this->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } + + memcpy (req.gfid, fdctx->gfid, 16); + + gf_msg_debug (frame->this->name, 0, + "attempting reopen on %s", local->loc.path); + + frame->local = local; + + ret = client_submit_request (this, &req, frame, conf->fops, + GFS3_OP_OPENDIR, + client4_0_reopendir_cbk, NULL, + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfx_opendir_req); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, + "failed to send the re-opendir request"); + } + + return 0; + +out: + if (local) + client_local_wipe (local); + + fdctx->reopen_done (fdctx, fdctx->remote_fd, this); + + return 0; + +} + +static int +protocol_client_reopenfile_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this) +{ + int ret = -1; + gfx_open_req req = {{0,},}; + clnt_local_t *local = NULL; + call_frame_t *frame = NULL; + clnt_conf_t *conf = NULL; + + conf = this->private; + + frame = create_frame (this, this->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } + + local = mem_get0 (this->local_pool); + if (!local) { + ret = -1; + goto out; + } + + local->fdctx = fdctx; + gf_uuid_copy (local->loc.gfid, fdctx->gfid); + ret = loc_path (&local->loc, NULL); + if (ret < 0) + goto out; + + frame->local = local; + + memcpy (req.gfid, fdctx->gfid, 16); + req.flags = gf_flags_from_flags (fdctx->flags); + req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL)); + + gf_msg_debug (frame->this->name, 0, + "attempting reopen on %s", local->loc.path); + + ret = client_submit_request (this, &req, frame, conf->fops, + GFS3_OP_OPEN, client4_0_reopen_cbk, NULL, + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfx_open_req); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, + "failed to send the re-open request"); + } + + return 0; + +out: + if (frame) { + frame->local = NULL; + STACK_DESTROY (frame->root); + } + + if (local) + client_local_wipe (local); + + fdctx->reopen_done (fdctx, fdctx->remote_fd, this); + + return 0; + +} + +static void +protocol_client_reopen_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this) +{ + if (fdctx->is_dir) + protocol_client_reopendir_v2 (fdctx, this); + else + protocol_client_reopenfile_v2 (fdctx, this); +} + gf_boolean_t __is_fd_reopen_in_progress (clnt_fd_ctx_t *fdctx) { @@ -695,8 +946,12 @@ client_attempt_reopen (fd_t *fd, xlator_t *this) } unlock: pthread_spin_unlock (&conf->fd_lock); - if (reopen) - protocol_client_reopen (fdctx, this); + if (reopen) { + if (conf->fops->progver == GLUSTER_FOP_VERSION_v2) + protocol_client_reopen_v2 (fdctx, this); + else + protocol_client_reopen (fdctx, this); + } out: return; } @@ -743,7 +998,10 @@ client_post_handshake (call_frame_t *frame, xlator_t *this) list_for_each_entry_safe (fdctx, tmp, &reopen_head, sfd_pos) { list_del_init (&fdctx->sfd_pos); - protocol_client_reopen (fdctx, this); + if (conf->fops->progver == GLUSTER_FOP_VERSION_v2) + protocol_client_reopen_v2 (fdctx, this); + else + protocol_client_reopen (fdctx, this); } } else { gf_msg_debug (this->name, 0, diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 4279a32a054..03ca2172692 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -6356,70 +6356,3 @@ rpc_clnt_prog_t clnt3_3_fop_prog = { .proctable = clnt3_3_fop_actors, .procnames = clnt3_3_fop_names, }; - -rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = { - [GF_FOP_NULL] = { "NULL", NULL}, - [GF_FOP_STAT] = { "STAT", client3_3_stat }, - [GF_FOP_READLINK] = { "READLINK", client3_3_readlink }, - [GF_FOP_MKNOD] = { "MKNOD", client3_3_mknod }, - [GF_FOP_MKDIR] = { "MKDIR", client3_3_mkdir }, - [GF_FOP_UNLINK] = { "UNLINK", client3_3_unlink }, - [GF_FOP_RMDIR] = { "RMDIR", client3_3_rmdir }, - [GF_FOP_SYMLINK] = { "SYMLINK", client3_3_symlink }, - [GF_FOP_RENAME] = { "RENAME", client3_3_rename }, - [GF_FOP_LINK] = { "LINK", client3_3_link }, - [GF_FOP_TRUNCATE] = { "TRUNCATE", client3_3_truncate }, - [GF_FOP_OPEN] = { "OPEN", client3_3_open }, - [GF_FOP_READ] = { "READ", client3_3_readv }, - [GF_FOP_WRITE] = { "WRITE", client3_3_writev }, - [GF_FOP_STATFS] = { "STATFS", client3_3_statfs }, - [GF_FOP_FLUSH] = { "FLUSH", client3_3_flush }, - [GF_FOP_FSYNC] = { "FSYNC", client3_3_fsync }, - [GF_FOP_SETXATTR] = { "SETXATTR", client3_3_setxattr }, - [GF_FOP_GETXATTR] = { "GETXATTR", client3_3_getxattr }, - [GF_FOP_REMOVEXATTR] = { "REMOVEXATTR", client3_3_removexattr }, - [GF_FOP_OPENDIR] = { "OPENDIR", client3_3_opendir }, - [GF_FOP_FSYNCDIR] = { "FSYNCDIR", client3_3_fsyncdir }, - [GF_FOP_ACCESS] = { "ACCESS", client3_3_access }, - [GF_FOP_CREATE] = { "CREATE", client3_3_create }, - [GF_FOP_FTRUNCATE] = { "FTRUNCATE", client3_3_ftruncate }, - [GF_FOP_FSTAT] = { "FSTAT", client3_3_fstat }, - [GF_FOP_LK] = { "LK", client3_3_lk }, - [GF_FOP_LOOKUP] = { "LOOKUP", client3_3_lookup }, - [GF_FOP_READDIR] = { "READDIR", client3_3_readdir }, - [GF_FOP_INODELK] = { "INODELK", client3_3_inodelk }, - [GF_FOP_FINODELK] = { "FINODELK", client3_3_finodelk }, - [GF_FOP_ENTRYLK] = { "ENTRYLK", client3_3_entrylk }, - [GF_FOP_FENTRYLK] = { "FENTRYLK", client3_3_fentrylk }, - [GF_FOP_XATTROP] = { "XATTROP", client3_3_xattrop }, - [GF_FOP_FXATTROP] = { "FXATTROP", client3_3_fxattrop }, - [GF_FOP_FGETXATTR] = { "FGETXATTR", client3_3_fgetxattr }, - [GF_FOP_FSETXATTR] = { "FSETXATTR", client3_3_fsetxattr }, - [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client3_3_rchecksum }, - [GF_FOP_SETATTR] = { "SETATTR", client3_3_setattr }, - [GF_FOP_FSETATTR] = { "FSETATTR", client3_3_fsetattr }, - [GF_FOP_READDIRP] = { "READDIRP", client3_3_readdirp }, - [GF_FOP_FALLOCATE] = { "FALLOCATE", client3_3_fallocate }, - [GF_FOP_DISCARD] = { "DISCARD", client3_3_discard }, - [GF_FOP_ZEROFILL] = { "ZEROFILL", client3_3_zerofill}, - [GF_FOP_RELEASE] = { "RELEASE", client3_3_release }, - [GF_FOP_RELEASEDIR] = { "RELEASEDIR", client3_3_releasedir }, - [GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec }, - [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client3_3_fremovexattr }, - [GF_FOP_IPC] = { "IPC", client3_3_ipc }, - [GF_FOP_SEEK] = { "SEEK", client3_3_seek }, - [GF_FOP_LEASE] = { "LEASE", client3_3_lease }, - [GF_FOP_GETACTIVELK] = { "GETACTIVELK", client3_3_getactivelk}, - [GF_FOP_SETACTIVELK] = { "SETACTIVELK", client3_3_setactivelk}, - [GF_FOP_COMPOUND] = { "COMPOUND", client3_3_compound }, -}; - - -rpc_clnt_prog_t clnt4_0_fop_prog = { - .progname = "GlusterFS 4.x v1", - .prognum = GLUSTER_FOP_PROGRAM, - .progver = GLUSTER_FOP_VERSION_v2, - .numproc = GLUSTER_FOP_PROCCNT, - .proctable = clnt4_0_fop_actors, - .procnames = clnt3_3_fop_names, -}; diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c index d30d56e9929..a4119bf7c1c 100644 --- a/xlators/protocol/client/src/client-rpc-fops_v2.c +++ b/xlators/protocol/client/src/client-rpc-fops_v2.c @@ -20,6 +20,8 @@ extern int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data); +extern int32_t +client3_3_getxattr (call_frame_t *frame, xlator_t *this, void *data); extern int client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, @@ -891,6 +893,12 @@ out: loc_gfid_utoa (&local->loc), (local->name) ? local->name : "(null)"); } + } else { + /* This is required as many places, `if (ret)` is checked + for syncop_getxattr() */ + gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d", + rsp.op_ret); + rsp.op_ret = 0; } CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata); @@ -952,6 +960,12 @@ out: PC_MSG_REMOTE_OP_FAILED, "remote operation " "failed"); } + } else { + /* This is required as many places, `if (ret)` is checked + for syncop_fgetxattr() */ + gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d", + rsp.op_ret); + rsp.op_ret = 0; } CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata); @@ -1488,6 +1502,12 @@ out: PC_MSG_REMOTE_OP_FAILED, "remote operation failed. " "Path: %s (%s)", local->loc.path, loc_gfid_utoa (&local->loc)); + } else { + /* This is required as many places, `if (ret)` is checked + for syncop_xattrop() */ + gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d", + rsp.op_ret); + rsp.op_ret = 0; } CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret, @@ -1548,10 +1568,17 @@ out: gf_error_to_errno (rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); - } else if (rsp.op_ret == 0) { + } else { + /* This is required as many places, `if (ret)` is checked + for syncop_fxattrop() */ + gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d", + rsp.op_ret); + rsp.op_ret = 0; + if (local->attempt_reopen) client_attempt_reopen (local->fd, this); } + CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret, gf_error_to_errno (op_errno), dict, xdata); if (xdata) @@ -5480,7 +5507,7 @@ client4_icreate_cbk (struct rpc_req *req, return 0; } int32_t -client4_namelink (call_frame_t *frame, xlator_t *this, void *data) +client4_0_namelink (call_frame_t *frame, xlator_t *this, void *data) { int32_t ret = 0; int32_t op_errno = EINVAL; @@ -5526,7 +5553,7 @@ client4_namelink (call_frame_t *frame, xlator_t *this, void *data) } int32_t -client4_icreate (call_frame_t *frame, xlator_t *this, void *data) +client4_0_icreate (call_frame_t *frame, xlator_t *this, void *data) { int32_t ret = 0; int32_t op_errno = EINVAL; @@ -5934,3 +5961,72 @@ char *clnt4_0_fop_names[GFS3_OP_MAXVALUE] = { [GFS3_OP_ICREATE] = "ICREATE", [GFS3_OP_NAMELINK] = "NAMELINK", }; + +rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = { + [GF_FOP_NULL] = { "NULL", NULL}, + [GF_FOP_STAT] = { "STAT", client4_0_stat }, + [GF_FOP_READLINK] = { "READLINK", client4_0_readlink }, + [GF_FOP_MKNOD] = { "MKNOD", client4_0_mknod }, + [GF_FOP_MKDIR] = { "MKDIR", client4_0_mkdir }, + [GF_FOP_UNLINK] = { "UNLINK", client4_0_unlink }, + [GF_FOP_RMDIR] = { "RMDIR", client4_0_rmdir }, + [GF_FOP_SYMLINK] = { "SYMLINK", client4_0_symlink }, + [GF_FOP_RENAME] = { "RENAME", client4_0_rename }, + [GF_FOP_LINK] = { "LINK", client4_0_link }, + [GF_FOP_TRUNCATE] = { "TRUNCATE", client4_0_truncate }, + [GF_FOP_OPEN] = { "OPEN", client4_0_open }, + [GF_FOP_READ] = { "READ", client4_0_readv }, + [GF_FOP_WRITE] = { "WRITE", client4_0_writev }, + [GF_FOP_STATFS] = { "STATFS", client4_0_statfs }, + [GF_FOP_FLUSH] = { "FLUSH", client4_0_flush }, + [GF_FOP_FSYNC] = { "FSYNC", client4_0_fsync }, + [GF_FOP_GETXATTR] = { "GETXATTR", client4_0_getxattr }, + [GF_FOP_SETXATTR] = { "SETXATTR", client4_0_setxattr }, + [GF_FOP_REMOVEXATTR] = { "REMOVEXATTR", client4_0_removexattr }, + [GF_FOP_OPENDIR] = { "OPENDIR", client4_0_opendir }, + [GF_FOP_FSYNCDIR] = { "FSYNCDIR", client4_0_fsyncdir }, + [GF_FOP_ACCESS] = { "ACCESS", client4_0_access }, + [GF_FOP_CREATE] = { "CREATE", client4_0_create }, + [GF_FOP_FTRUNCATE] = { "FTRUNCATE", client4_0_ftruncate }, + [GF_FOP_FSTAT] = { "FSTAT", client4_0_fstat }, + [GF_FOP_LK] = { "LK", client4_0_lk }, + [GF_FOP_LOOKUP] = { "LOOKUP", client4_0_lookup }, + [GF_FOP_READDIR] = { "READDIR", client4_0_readdir }, + [GF_FOP_INODELK] = { "INODELK", client4_0_inodelk }, + [GF_FOP_FINODELK] = { "FINODELK", client4_0_finodelk }, + [GF_FOP_ENTRYLK] = { "ENTRYLK", client4_0_entrylk }, + [GF_FOP_FENTRYLK] = { "FENTRYLK", client4_0_fentrylk }, + [GF_FOP_XATTROP] = { "XATTROP", client4_0_xattrop }, + [GF_FOP_FXATTROP] = { "FXATTROP", client4_0_fxattrop }, + [GF_FOP_FGETXATTR] = { "FGETXATTR", client4_0_fgetxattr }, + [GF_FOP_FSETXATTR] = { "FSETXATTR", client4_0_fsetxattr }, + [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client4_0_rchecksum }, + [GF_FOP_SETATTR] = { "SETATTR", client4_0_setattr }, + [GF_FOP_FSETATTR] = { "FSETATTR", client4_0_fsetattr }, + [GF_FOP_READDIRP] = { "READDIRP", client4_0_readdirp }, + [GF_FOP_FALLOCATE] = { "FALLOCATE", client4_0_fallocate }, + [GF_FOP_DISCARD] = { "DISCARD", client4_0_discard }, + [GF_FOP_ZEROFILL] = { "ZEROFILL", client4_0_zerofill}, + [GF_FOP_RELEASE] = { "RELEASE", client4_0_release }, + [GF_FOP_RELEASEDIR] = { "RELEASEDIR", client4_0_releasedir }, + [GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec }, + [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client4_0_fremovexattr }, + [GF_FOP_IPC] = { "IPC", client4_0_ipc }, + [GF_FOP_SEEK] = { "SEEK", client4_0_seek }, + [GF_FOP_LEASE] = { "LEASE", client4_0_lease }, + [GF_FOP_GETACTIVELK] = { "GETACTIVELK", client4_0_getactivelk }, + [GF_FOP_SETACTIVELK] = { "SETACTIVELK", client4_0_setactivelk }, + [GF_FOP_COMPOUND] = { "COMPOUND", client4_0_compound }, + [GF_FOP_ICREATE] = { "ICREATE", client4_0_icreate }, + [GF_FOP_NAMELINK] = { "NAMELINK", client4_0_namelink }, +}; + + +rpc_clnt_prog_t clnt4_0_fop_prog = { + .progname = "GlusterFS 4.x v1", + .prognum = GLUSTER_FOP_PROGRAM, + .progver = GLUSTER_FOP_VERSION_v2, + .numproc = GLUSTER_FOP_PROCCNT, + .proctable = clnt4_0_fop_actors, + .procnames = clnt4_0_fop_names, +}; diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index 7f2bd5e0312..2c3f71bb245 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -6155,68 +6155,3 @@ struct rpcsvc_program glusterfs3_3_fop_prog = { .actors = glusterfs3_3_fop_actors, .ownthread = _gf_true, }; - -rpcsvc_actor_t glusterfs4_0_fop_actors[] = { - [GFS3_OP_NULL] = { "NULL", GFS3_OP_NULL, server_null, NULL, 0}, - [GFS3_OP_STAT] = { "STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0}, - [GFS3_OP_READLINK] = { "READLINK", GFS3_OP_READLINK, server3_3_readlink, NULL, 0}, - [GFS3_OP_MKNOD] = { "MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0}, - [GFS3_OP_MKDIR] = { "MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0}, - [GFS3_OP_UNLINK] = { "UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0}, - [GFS3_OP_RMDIR] = { "RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0}, - [GFS3_OP_SYMLINK] = { "SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0}, - [GFS3_OP_RENAME] = { "RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0}, - [GFS3_OP_LINK] = { "LINK", GFS3_OP_LINK, server3_3_link, NULL, 0}, - [GFS3_OP_TRUNCATE] = { "TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate, NULL, 0}, - [GFS3_OP_OPEN] = { "OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0}, - [GFS3_OP_READ] = { "READ", GFS3_OP_READ, server3_3_readv, NULL, 0}, - [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server3_3_writev, server3_3_writev_vecsizer, 0}, - [GFS3_OP_STATFS] = { "STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0}, - [GFS3_OP_FLUSH] = { "FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0}, - [GFS3_OP_FSYNC] = { "FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0}, - [GFS3_OP_SETXATTR] = { "SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr, NULL, 0}, - [GFS3_OP_GETXATTR] = { "GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr, NULL, 0}, - [GFS3_OP_REMOVEXATTR] = { "REMOVEXATTR", GFS3_OP_REMOVEXATTR, server3_3_removexattr, NULL, 0}, - [GFS3_OP_OPENDIR] = { "OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0}, - [GFS3_OP_FSYNCDIR] = { "FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir, NULL, 0}, - [GFS3_OP_ACCESS] = { "ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0}, - [GFS3_OP_CREATE] = { "CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0}, - [GFS3_OP_FTRUNCATE] = { "FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate, NULL, 0}, - [GFS3_OP_FSTAT] = { "FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0}, - [GFS3_OP_LK] = { "LK", GFS3_OP_LK, server3_3_lk, NULL, 0}, - [GFS3_OP_LOOKUP] = { "LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0}, - [GFS3_OP_READDIR] = { "READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0}, - [GFS3_OP_INODELK] = { "INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0}, - [GFS3_OP_FINODELK] = { "FINODELK", GFS3_OP_FINODELK, server3_3_finodelk, NULL, 0}, - [GFS3_OP_ENTRYLK] = { "ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0}, - [GFS3_OP_FENTRYLK] = { "FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk, NULL, 0}, - [GFS3_OP_XATTROP] = { "XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0}, - [GFS3_OP_FXATTROP] = { "FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop, NULL, 0}, - [GFS3_OP_FGETXATTR] = { "FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr, NULL, 0}, - [GFS3_OP_FSETXATTR] = { "FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr, NULL, 0}, - [GFS3_OP_RCHECKSUM] = { "RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum, NULL, 0}, - [GFS3_OP_SETATTR] = { "SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0}, - [GFS3_OP_FSETATTR] = { "FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr, NULL, 0}, - [GFS3_OP_READDIRP] = { "READDIRP", GFS3_OP_READDIRP, server3_3_readdirp, NULL, 0}, - [GFS3_OP_RELEASE] = { "RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0}, - [GFS3_OP_RELEASEDIR] = { "RELEASEDIR", GFS3_OP_RELEASEDIR, server3_3_releasedir, NULL, 0}, - [GFS3_OP_FREMOVEXATTR] = { "FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server3_3_fremovexattr, NULL, 0}, - [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server3_3_fallocate, NULL, 0, DRC_NA}, - [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server3_3_discard, NULL, 0, DRC_NA}, - [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server3_3_zerofill, NULL, 0, DRC_NA}, - [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server3_3_ipc, NULL, 0, DRC_NA}, - [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server3_3_seek, NULL, 0, DRC_NA}, - [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server3_3_lease, NULL, 0, DRC_NA}, - [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK, server3_3_getactivelk, NULL, 0, DRC_NA}, - [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK, server3_3_setactivelk, NULL, 0, DRC_NA}, - [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server3_3_compound, NULL, 0, DRC_NA}, -}; - - -struct rpcsvc_program glusterfs4_0_fop_prog = { - .progname = "GlusterFS 4.x v1", - .prognum = GLUSTER_FOP_PROGRAM, - .progver = GLUSTER_FOP_VERSION_v2, - .numactors = GLUSTER_FOP_PROCCNT, - .actors = glusterfs4_0_fop_actors, -}; diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c index dca88ab85f5..b67a2c966a2 100644 --- a/xlators/protocol/server/src/server-rpc-fops_v2.c +++ b/xlators/protocol/server/src/server-rpc-fops_v2.c @@ -33,16 +33,6 @@ extern int server3_3_getxattr (rpcsvc_request_t *req); -extern int -server3_3_fgetxattr (rpcsvc_request_t *req); -extern int -server3_3_setxattr (rpcsvc_request_t *req); -extern int -server3_3_fsetxattr (rpcsvc_request_t *req); -extern int -server3_3_xattrop (rpcsvc_request_t *req); -extern int -server3_3_fxattrop (rpcsvc_request_t *req); extern void set_resolve_gfid (client_t *client, uuid_t resolve_gfid, @@ -5529,7 +5519,7 @@ out: } int -server4_namelink (rpcsvc_request_t *req) +server4_0_namelink (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; @@ -5564,7 +5554,7 @@ out: } int -server4_icreate (rpcsvc_request_t *req) +server4_0_icreate (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; @@ -5857,3 +5847,71 @@ out: return ret; } + + +rpcsvc_actor_t glusterfs4_0_fop_actors[] = { + [GFS3_OP_NULL] = { "NULL", GFS3_OP_NULL, server_null, NULL, 0}, + [GFS3_OP_STAT] = { "STAT", GFS3_OP_STAT, server4_0_stat, NULL, 0}, + [GFS3_OP_READLINK] = { "READLINK", GFS3_OP_READLINK, server4_0_readlink, NULL, 0}, + [GFS3_OP_MKNOD] = { "MKNOD", GFS3_OP_MKNOD, server4_0_mknod, NULL, 0}, + [GFS3_OP_MKDIR] = { "MKDIR", GFS3_OP_MKDIR, server4_0_mkdir, NULL, 0}, + [GFS3_OP_UNLINK] = { "UNLINK", GFS3_OP_UNLINK, server4_0_unlink, NULL, 0}, + [GFS3_OP_RMDIR] = { "RMDIR", GFS3_OP_RMDIR, server4_0_rmdir, NULL, 0}, + [GFS3_OP_SYMLINK] = { "SYMLINK", GFS3_OP_SYMLINK, server4_0_symlink, NULL, 0}, + [GFS3_OP_RENAME] = { "RENAME", GFS3_OP_RENAME, server4_0_rename, NULL, 0}, + [GFS3_OP_LINK] = { "LINK", GFS3_OP_LINK, server4_0_link, NULL, 0}, + [GFS3_OP_TRUNCATE] = { "TRUNCATE", GFS3_OP_TRUNCATE, server4_0_truncate, NULL, 0}, + [GFS3_OP_OPEN] = { "OPEN", GFS3_OP_OPEN, server4_0_open, NULL, 0}, + [GFS3_OP_READ] = { "READ", GFS3_OP_READ, server4_0_readv, NULL, 0}, + [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server4_0_writev, server4_0_writev_vecsizer, 0}, + [GFS3_OP_STATFS] = { "STATFS", GFS3_OP_STATFS, server4_0_statfs, NULL, 0}, + [GFS3_OP_FLUSH] = { "FLUSH", GFS3_OP_FLUSH, server4_0_flush, NULL, 0}, + [GFS3_OP_FSYNC] = { "FSYNC", GFS3_OP_FSYNC, server4_0_fsync, NULL, 0}, + [GFS3_OP_GETXATTR] = { "GETXATTR", GFS3_OP_GETXATTR, server4_0_getxattr, NULL, 0}, + [GFS3_OP_SETXATTR] = { "SETXATTR", GFS3_OP_SETXATTR, server4_0_setxattr, NULL, 0}, + [GFS3_OP_REMOVEXATTR] = { "REMOVEXATTR", GFS3_OP_REMOVEXATTR, server4_0_removexattr, NULL, 0}, + [GFS3_OP_OPENDIR] = { "OPENDIR", GFS3_OP_OPENDIR, server4_0_opendir, NULL, 0}, + [GFS3_OP_FSYNCDIR] = { "FSYNCDIR", GFS3_OP_FSYNCDIR, server4_0_fsyncdir, NULL, 0}, + [GFS3_OP_ACCESS] = { "ACCESS", GFS3_OP_ACCESS, server4_0_access, NULL, 0}, + [GFS3_OP_CREATE] = { "CREATE", GFS3_OP_CREATE, server4_0_create, NULL, 0}, + [GFS3_OP_FTRUNCATE] = { "FTRUNCATE", GFS3_OP_FTRUNCATE, server4_0_ftruncate, NULL, 0}, + [GFS3_OP_FSTAT] = { "FSTAT", GFS3_OP_FSTAT, server4_0_fstat, NULL, 0}, + [GFS3_OP_LK] = { "LK", GFS3_OP_LK, server4_0_lk, NULL, 0}, + [GFS3_OP_LOOKUP] = { "LOOKUP", GFS3_OP_LOOKUP, server4_0_lookup, NULL, 0}, + [GFS3_OP_READDIR] = { "READDIR", GFS3_OP_READDIR, server4_0_readdir, NULL, 0}, + [GFS3_OP_INODELK] = { "INODELK", GFS3_OP_INODELK, server4_0_inodelk, NULL, 0}, + [GFS3_OP_FINODELK] = { "FINODELK", GFS3_OP_FINODELK, server4_0_finodelk, NULL, 0}, + [GFS3_OP_ENTRYLK] = { "ENTRYLK", GFS3_OP_ENTRYLK, server4_0_entrylk, NULL, 0}, + [GFS3_OP_FENTRYLK] = { "FENTRYLK", GFS3_OP_FENTRYLK, server4_0_fentrylk, NULL, 0}, + [GFS3_OP_XATTROP] = { "XATTROP", GFS3_OP_XATTROP, server4_0_xattrop, NULL, 0}, + [GFS3_OP_FXATTROP] = { "FXATTROP", GFS3_OP_FXATTROP, server4_0_fxattrop, NULL, 0}, + [GFS3_OP_FGETXATTR] = { "FGETXATTR", GFS3_OP_FGETXATTR, server4_0_fgetxattr, NULL, 0}, + [GFS3_OP_FSETXATTR] = { "FSETXATTR", GFS3_OP_FSETXATTR, server4_0_fsetxattr, NULL, 0}, + [GFS3_OP_RCHECKSUM] = { "RCHECKSUM", GFS3_OP_RCHECKSUM, server4_0_rchecksum, NULL, 0}, + [GFS3_OP_SETATTR] = { "SETATTR", GFS3_OP_SETATTR, server4_0_setattr, NULL, 0}, + [GFS3_OP_FSETATTR] = { "FSETATTR", GFS3_OP_FSETATTR, server4_0_fsetattr, NULL, 0}, + [GFS3_OP_READDIRP] = { "READDIRP", GFS3_OP_READDIRP, server4_0_readdirp, NULL, 0}, + [GFS3_OP_RELEASE] = { "RELEASE", GFS3_OP_RELEASE, server4_0_release, NULL, 0}, + [GFS3_OP_RELEASEDIR] = { "RELEASEDIR", GFS3_OP_RELEASEDIR, server4_0_releasedir, NULL, 0}, + [GFS3_OP_FREMOVEXATTR] = { "FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server4_0_fremovexattr, NULL, 0}, + [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server4_0_fallocate, NULL, 0, DRC_NA}, + [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server4_0_discard, NULL, 0, DRC_NA}, + [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server4_0_zerofill, NULL, 0, DRC_NA}, + [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server4_0_ipc, NULL, 0, DRC_NA}, + [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server4_0_seek, NULL, 0, DRC_NA}, + [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server4_0_lease, NULL, 0, DRC_NA}, + [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK, server4_0_getactivelk, NULL, 0, DRC_NA}, + [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK, server4_0_setactivelk, NULL, 0, DRC_NA}, + [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server4_0_compound, NULL, 0, DRC_NA}, + [GFS3_OP_ICREATE] = {"ICREATE", GFS3_OP_ICREATE, server4_0_icreate, NULL, 0, DRC_NA}, + [GFS3_OP_NAMELINK] = {"NAMELINK", GFS3_OP_NAMELINK, server4_0_namelink, NULL, 0, DRC_NA}, +}; + + +struct rpcsvc_program glusterfs4_0_fop_prog = { + .progname = "GlusterFS 4.x v1", + .prognum = GLUSTER_FOP_PROGRAM, + .progver = GLUSTER_FOP_VERSION_v2, + .numactors = GLUSTER_FOP_PROCCNT, + .actors = glusterfs4_0_fop_actors, +}; |