diff options
| author | Amar Tumballi <amarts@redhat.com> | 2017-10-10 17:13:25 +0530 | 
|---|---|---|
| committer | Amar Tumballi <amarts@redhat.com> | 2017-11-07 07:53:55 +0000 | 
| commit | e4240431b033d1f0c351d3d874c248126ca6cadc (patch) | |
| tree | d83c1dcb42fb8c6f7bd903422e8c351394124d52 /xlators/protocol | |
| parent | 56aef68530b3bab27730aa62e4fbc513d3dba65f (diff) | |
rpc: bring a new protocol version
* xdr: add gfid to on wire format for fsetattr/rchecksum
* as it is change in on wire XDR format, needed backward
  compatible RPC programs.
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 827334
Change-Id: Id0a2da3632516dc1a5560dde2b151b2e5f0be8e5
Diffstat (limited to 'xlators/protocol')
| -rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 14 | ||||
| -rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 161 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 184 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server.c | 13 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server.h | 1 | 
5 files changed, 373 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index 6fdea91fa38..587e256b51a 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -23,6 +23,7 @@  #define CLIENT_REOPEN_MAX_ATTEMPTS 1024  extern rpc_clnt_prog_t clnt3_3_fop_prog; +extern rpc_clnt_prog_t clnt4_0_fop_prog;  extern rpc_clnt_prog_t clnt_pmap_prog;  int client_set_lk_version_cbk (struct rpc_req *req, struct iovec *iov, @@ -1487,6 +1488,19 @@ select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)                                  trav->progname, trav->prognum, trav->progver);                          ret = 0;                  } + +                if ((clnt4_0_fop_prog.prognum == trav->prognum) && +                    (clnt4_0_fop_prog.progver == trav->progver)) { +                        conf->fops = &clnt4_0_fop_prog; +                        gf_msg (this->name, GF_LOG_INFO, 0, +                                PC_MSG_VERSION_INFO, "Using Program %s," +                                " Num (%"PRId64"), Version (%"PRId64")", +                                trav->progname, trav->prognum, trav->progver); +                        ret = 0; +                        /* this is latest program, lets use it */ +                        goto out; +                } +                  if (ret) {                          gf_msg_trace (this->name, 0,                                        "%s (%"PRId64") not supported", diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 2026a2b1c80..9f0a752ccf6 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -6249,6 +6249,100 @@ unwind:          return 0;  } +int32_t +client4_0_fsetattr (call_frame_t *frame, xlator_t *this, void *data) +{ +        clnt_args_t          *args      = NULL; +        int64_t               remote_fd = -1; +        clnt_conf_t          *conf      = NULL; +        gfs3_fsetattr_req_v2  req       = {{0},}; +        int                   op_errno  = ESTALE; +        int                   ret       = 0; + +        if (!frame || !this || !data) +                goto unwind; + +        args = data; +        conf = this->private; + +        CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, +                             remote_fd, op_errno, unwind); + +        req.fd = remote_fd; +        req.valid = args->valid; +        gf_stat_from_iatt (&req.stbuf, args->stbuf); +        memcpy (req.gfid, args->fd->inode->gfid, 16); + +        GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), +                                    req.xdata.xdata_len, op_errno, unwind); + +        ret = client_submit_request (this, &req, frame, conf->fops, +                                     GFS3_OP_FSETATTR, +                                     client3_3_fsetattr_cbk, NULL, +                                     NULL, 0, NULL, 0, +                                     NULL, (xdrproc_t)xdr_gfs3_fsetattr_req_v2); +        if (ret) { +                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); +        } + +        GF_FREE (req.xdata.xdata_val); + +        return 0; +unwind: +        CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); +        GF_FREE (req.xdata.xdata_val); + +        return 0; +} + +int32_t +client4_0_rchecksum (call_frame_t *frame, xlator_t *this, +                     void *data) +{ +        clnt_args_t           *args      = NULL; +        int64_t                remote_fd = -1; +        clnt_conf_t           *conf      = NULL; +        gfs3_rchecksum_req_v2  req       = {{0},}; +        int                    op_errno  = ESTALE; +        int                    ret       = 0; + +        if (!frame || !this || !data) +                goto unwind; + +        args = data; +        conf = this->private; + +        CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, +                             remote_fd, op_errno, unwind); + +        req.len    = args->len; +        req.offset = args->offset; +        req.fd     = remote_fd; +        memcpy (req.gfid, args->fd->inode->gfid, 16); + +        GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), +                                    req.xdata.xdata_len, op_errno, unwind); + +        ret = client_submit_request (this, &req, frame, conf->fops, +                                     GFS3_OP_RCHECKSUM, +                                     client3_3_rchecksum_cbk, NULL, +                                     NULL, 0, NULL, +                                     0, NULL, +                                     (xdrproc_t)xdr_gfs3_rchecksum_req_v2); +        if (ret) { +                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); +        } + +        GF_FREE (req.xdata.xdata_val); + +        return 0; +unwind: +        CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL); +        GF_FREE (req.xdata.xdata_val); + +        return 0; +} +  /* Table Specific to FOPS */  rpc_clnt_procedure_t clnt3_3_fop_actors[GF_FOP_MAXVALUE] = {          [GF_FOP_NULL]         = { "NULL",         NULL}, @@ -6372,3 +6466,70 @@ 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",   client4_0_rchecksum }, +        [GF_FOP_SETATTR]     = { "SETATTR",     client3_3_setattr }, +        [GF_FOP_FSETATTR]    = { "FSETATTR",    client4_0_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/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index c947f066833..8666684bb35 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -6873,6 +6873,125 @@ out:          return ret;  } +int +server4_0_fsetattr (rpcsvc_request_t *req) +{ +        server_state_t       *state    = NULL; +        call_frame_t         *frame    = NULL; +        gfs3_fsetattr_req_v2  args     = {{0},}; +        int                   ret      = -1; +        int                   op_errno = 0; + +        if (!req) +                return ret; + +        ret = xdr_to_generic (req->msg[0], &args, +                              (xdrproc_t)xdr_gfs3_fsetattr_req_v2); +        if (ret < 0) { +                /* failed to decode msg; */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } + +        frame = get_frame_from_request (req); +        if (!frame) { +                /* something wrong, mostly insufficient memory */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } +        frame->root->op = GF_FOP_FSETATTR; + +        state = CALL_STATE (frame); +        if (!frame->root->client->bound_xl) { +                /* auth failure, request on subvolume without setvolume */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } + +        state->resolve.type   = RESOLVE_MUST; +        state->resolve.fd_no  = args.fd; +        memcpy (state->resolve.gfid, args.gfid, 16); + +        gf_stat_to_iatt (&args.stbuf, &state->stbuf); +        state->valid = args.valid; + +        GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl, +                                      state->xdata, (args.xdata.xdata_val), +                                      (args.xdata.xdata_len), ret, +                                      op_errno, out); + +        ret = 0; +        resolve_and_resume (frame, server_fsetattr_resume); + +out: +        free (args.xdata.xdata_val); + +        if (op_errno) +                SERVER_REQ_SET_ERROR (req, ret); + +        return ret; +} + +int +server4_0_rchecksum (rpcsvc_request_t *req) +{ +        server_state_t        *state    = NULL; +        call_frame_t          *frame    = NULL; +        gfs3_rchecksum_req_v2  args     = {{0},}; +        int                    ret      = -1; +        int                    op_errno = 0; + +        if (!req) +                return ret; + +        ret = xdr_to_generic (req->msg[0], &args, +                              (xdrproc_t)xdr_gfs3_rchecksum_req_v2); +        if (ret < 0) { +                /* failed to decode msg; */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } + +        frame = get_frame_from_request (req); +        if (!frame) { +                /* something wrong, mostly insufficient memory */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } +        frame->root->op = GF_FOP_RCHECKSUM; + +        state = CALL_STATE(frame); +        if (!frame->root->client->bound_xl) { +                /* auth failure, request on subvolume without setvolume */ +                SERVER_REQ_SET_ERROR (req, ret); +                goto out; +        } + +        state->resolve.type  = RESOLVE_MAY; +        state->resolve.fd_no = args.fd; +        state->offset        = args.offset; +        state->size          = args.len; + +        memcpy (state->resolve.gfid, args.gfid, 16); + +        GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl, +                                      state->xdata, (args.xdata.xdata_val), +                                      (args.xdata.xdata_len), ret, +                                      op_errno, out); + +        ret = 0; +        resolve_and_resume (frame, server_rchecksum_resume); +out: +        free (args.xdata.xdata_val); + +        if (op_errno) +                SERVER_REQ_SET_ERROR (req, ret); + +        return ret; +} + + +  rpcsvc_actor_t glusterfs3_3_fop_actors[GLUSTER_FOP_PROCCNT] = {          [GFS3_OP_NULL]         = {"NULL",         GFS3_OP_NULL,         server_null,            NULL, 0, DRC_NA},          [GFS3_OP_STAT]         = {"STAT",         GFS3_OP_STAT,         server3_3_stat,         NULL, 0, DRC_NA}, @@ -6938,3 +7057,68 @@ 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, server4_0_rchecksum, NULL, 0}, +        [GFS3_OP_SETATTR]     = { "SETATTR",    GFS3_OP_SETATTR, server3_3_setattr, NULL, 0}, +        [GFS3_OP_FSETATTR]    = { "FSETATTR",   GFS3_OP_FSETATTR, server4_0_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.c b/xlators/protocol/server/src/server.c index b408c10b0a0..86f17a6550e 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -1201,6 +1201,18 @@ init (xlator_t *this)                  goto out;          } +        glusterfs4_0_fop_prog.options = this->options; +        ret = rpcsvc_program_register (conf->rpc, &glusterfs4_0_fop_prog); +        if (ret) { +                gf_log (this->name, GF_LOG_WARNING, +                        "registration of program (name:%s, prognum:%d, " +                        "progver:%d) failed", glusterfs4_0_fop_prog.progname, +                        glusterfs4_0_fop_prog.prognum, +                        glusterfs4_0_fop_prog.progver); +                rpcsvc_program_unregister (conf->rpc, &glusterfs3_3_fop_prog); +                goto out; +        } +          gluster_handshake_prog.options = this->options;          ret = rpcsvc_program_register (conf->rpc, &gluster_handshake_prog,                                         _gf_false); @@ -1211,6 +1223,7 @@ init (xlator_t *this)                          gluster_handshake_prog.prognum,                          gluster_handshake_prog.progver);                  rpcsvc_program_unregister (conf->rpc, &glusterfs3_3_fop_prog); +                rpcsvc_program_unregister (conf->rpc, &glusterfs4_0_fop_prog);                  goto out;          } diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index ea15b561be7..70af9fdecd3 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -212,6 +212,7 @@ struct _server_state {  extern struct rpcsvc_program gluster_handshake_prog;  extern struct rpcsvc_program glusterfs3_3_fop_prog; +extern struct rpcsvc_program glusterfs4_0_fop_prog;  typedef struct _server_ctx {          gf_lock_t            fdtable_lock;  | 
