diff options
author | Amar Tumballi <amarts@redhat.com> | 2018-01-18 10:31:38 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-02-01 11:40:24 +0000 |
commit | d663b9a323f34919da3f35bfc221a0aa91d9ab94 (patch) | |
tree | 0753cdaf840826567d65cda6bfcef73510aad8fa /xlators | |
parent | ce9055449477dd59f29de213d140c60b03e465eb (diff) |
protocol: utilize the version 4 xdr
updates #384
Change-Id: Id80bf470988dbecc69779de9eb64088559cb1f6a
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators')
-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 |
5 files changed, 430 insertions, 150 deletions
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 4471825c470..aad1666096b 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) @@ -5542,7 +5569,7 @@ out: } 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; @@ -5588,7 +5615,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; @@ -6055,3 +6082,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 2408c36ad15..c52b0f58e17 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, @@ -5599,7 +5589,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; @@ -5634,7 +5624,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; @@ -5996,3 +5986,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, +}; |