diff options
Diffstat (limited to 'xlators/protocol/client/src/client.c')
| -rw-r--r-- | xlators/protocol/client/src/client.c | 1088 |
1 files changed, 752 insertions, 336 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index ff766844d..f1415899e 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1,20 +1,11 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> This file is part of GlusterFS. - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ @@ -30,6 +21,7 @@ #include "statedump.h" #include "compat-errno.h" +#include "xdr-rpc.h" #include "glusterfs3.h" extern rpc_clnt_prog_t clnt_handshake_prog; @@ -40,22 +32,134 @@ int client_handshake (xlator_t *this, struct rpc_clnt *rpc); void client_start_ping (void *data); int client_init_rpc (xlator_t *this); int client_destroy_rpc (xlator_t *this); +int client_mark_fd_bad (xlator_t *this); + +int32_t +client_type_to_gf_type (short l_type) +{ + int32_t gf_type = GF_LK_EOL; + + switch (l_type) { + case F_RDLCK: + gf_type = GF_LK_F_RDLCK; + break; + case F_WRLCK: + gf_type = GF_LK_F_WRLCK; + break; + case F_UNLCK: + gf_type = GF_LK_F_UNLCK; + break; + } + + return gf_type; +} + +uint32_t +client_get_lk_ver (clnt_conf_t *conf) +{ + uint32_t lk_ver = 0; + + GF_VALIDATE_OR_GOTO ("client", conf, out); + + pthread_mutex_lock (&conf->lock); + { + lk_ver = conf->lk_version; + } + pthread_mutex_unlock (&conf->lock); +out: + return lk_ver; +} + +void +client_grace_timeout (void *data) +{ + int ver = 0; + xlator_t *this = NULL; + struct clnt_conf *conf = NULL; + struct rpc_clnt *rpc = NULL; + + GF_VALIDATE_OR_GOTO ("client", data, out); + + this = THIS; + + rpc = (struct rpc_clnt *) data; + + conf = (struct clnt_conf *) this->private; + + pthread_mutex_lock (&conf->lock); + { + ver = ++conf->lk_version; + /* ver == 0 is a special value used by server + to notify client that this is a fresh connect.*/ + if (ver == 0) + ver = ++conf->lk_version; + + gf_timer_call_cancel (this->ctx, conf->grace_timer); + conf->grace_timer = NULL; + } + pthread_mutex_unlock (&conf->lock); + + gf_log (this->name, GF_LOG_WARNING, + "client grace timer expired, updating " + "the lk-version to %d", ver); + + client_mark_fd_bad (this); +out: + return; +} + +int32_t +client_register_grace_timer (xlator_t *this, clnt_conf_t *conf) +{ + int32_t ret = -1; + + GF_VALIDATE_OR_GOTO ("client", this, out); + GF_VALIDATE_OR_GOTO (this->name, conf, out); + + pthread_mutex_lock (&conf->lock); + { + if (conf->grace_timer || !conf->grace_timer_needed) { + gf_log (this->name, GF_LOG_TRACE, + "Client grace timer is already set " + "or a grace-timer has already time out, " + "not registering a new timer"); + } else { + gf_log (this->name, GF_LOG_INFO, + "Registering a grace timer"); + + conf->grace_timer_needed = _gf_false; + + conf->grace_timer = + gf_timer_call_after (this->ctx, + conf->grace_ts, + client_grace_timeout, + conf->rpc); + } + } + pthread_mutex_unlock (&conf->lock); + + ret = 0; +out: + return ret; +} int client_submit_request (xlator_t *this, void *req, call_frame_t *frame, - rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbk, - struct iobref *iobref, gfs_serialize_t sfunc, - struct iovec *rsphdr, int rsphdr_count, - struct iovec *rsp_payload, int rsp_payload_count, - struct iobref *rsp_iobref) -{ - int ret = -1; - clnt_conf_t *conf = NULL; - struct iovec iov = {0, }; - struct iobuf *iobuf = NULL; - int count = 0; - char start_ping = 0; - struct iobref *new_iobref = NULL; + rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, + struct iobref *iobref, struct iovec *rsphdr, + int rsphdr_count, struct iovec *rsp_payload, + int rsp_payload_count, struct iobref *rsp_iobref, + xdrproc_t xdrproc) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + struct iovec iov = {0, }; + struct iobuf *iobuf = NULL; + int count = 0; + char start_ping = 0; + struct iobref *new_iobref = NULL; + ssize_t xdr_size = 0; + struct rpc_req rpcreq = {0, }; GF_VALIDATE_OR_GOTO ("client", this, out); GF_VALIDATE_OR_GOTO (this->name, prog, out); @@ -78,38 +182,39 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, goto out; } - iobuf = iobuf_get (this->ctx->iobuf_pool); - if (!iobuf) { - goto out; - }; + if (req && xdrproc) { + xdr_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); + if (!iobuf) { + goto out; + }; - new_iobref = iobref_new (); - if (!new_iobref) { - goto out; - } + new_iobref = iobref_new (); + if (!new_iobref) { + goto out; + } + + if (iobref != NULL) { + ret = iobref_merge (new_iobref, iobref); + if (ret != 0) { + gf_log (this->name, GF_LOG_WARNING, + "cannot merge iobref passed from caller " + "into new_iobref"); + } + } - if (iobref != NULL) { - ret = iobref_merge (new_iobref, iobref); + ret = iobref_add (new_iobref, iobuf); if (ret != 0) { gf_log (this->name, GF_LOG_WARNING, - "cannot merge iobref passed from caller " - "into new_iobref"); + "cannot add iobuf into iobref"); + goto out; } - } - ret = iobref_add (new_iobref, iobuf); - if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot add iobuf into iobref"); - goto out; - } + iov.iov_base = iobuf->ptr; + iov.iov_len = iobuf_size (iobuf); - iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; - - /* Create the xdr payload */ - if (req && sfunc) { - ret = sfunc (iov, req); + /* Create the xdr payload */ + ret = xdr_serialize_generic (iov, req, xdrproc); if (ret == -1) { /* callingfn so that, we can get to know which xdr function was called */ @@ -120,9 +225,10 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, iov.iov_len = ret; count = 1; } + /* Send the msg */ - ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbk, &iov, count, NULL, - 0, new_iobref, frame, rsphdr, rsphdr_count, + ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, + NULL, 0, new_iobref, frame, rsphdr, rsphdr_count, rsp_payload, rsp_payload_count, rsp_iobref); if (ret < 0) { @@ -143,14 +249,27 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, client_start_ping ((void *) this); ret = 0; -out: - if (new_iobref != NULL) + + if (new_iobref) iobref_unref (new_iobref); if (iobuf) iobuf_unref (iobuf); return ret; + +out: + rpcreq.rpc_status = -1; + + cbkfn (&rpcreq, NULL, 0, frame); + + if (new_iobref) + iobref_unref (new_iobref); + + if (iobuf) + iobuf_unref (iobuf); + + return 0; } @@ -168,7 +287,6 @@ client_releasedir (xlator_t *this, fd_t *fd) clnt_conf_t *conf = NULL; rpc_clnt_procedure_t *proc = NULL; clnt_args_t args = {0,}; - call_frame_t *frame = NULL; conf = this->private; if (!conf || !conf->fops) @@ -184,11 +302,7 @@ client_releasedir (xlator_t *this, fd_t *fd) goto out; } if (proc->fn) { - frame = create_frame (this, this->ctx->pool); - if (!frame) { - goto out; - } - ret = proc->fn (frame, this, &args); + ret = proc->fn (NULL, this, &args); } out: if (ret) @@ -204,7 +318,6 @@ client_release (xlator_t *this, fd_t *fd) clnt_conf_t *conf = NULL; rpc_clnt_procedure_t *proc = NULL; clnt_args_t args = {0,}; - call_frame_t *frame = NULL; conf = this->private; if (!conf || !conf->fops) @@ -219,11 +332,7 @@ client_release (xlator_t *this, fd_t *fd) goto out; } if (proc->fn) { - frame = create_frame (this, this->ctx->pool); - if (!frame) { - goto out; - } - ret = proc->fn (frame, this, &args); + ret = proc->fn (NULL, this, &args); } out: if (ret) @@ -235,7 +344,7 @@ out: int32_t client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xattr_req) + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -247,7 +356,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, goto out; args.loc = loc; - args.dict = xattr_req; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LOOKUP]; if (!proc) { @@ -269,7 +378,7 @@ out: int32_t -client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -281,6 +390,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STAT]; if (!proc) { @@ -293,14 +403,15 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL, NULL); return 0; } int32_t -client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) +client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, + off_t offset, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -313,6 +424,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) args.loc = loc; args.offset = offset; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_TRUNCATE]; if (!proc) { @@ -325,7 +437,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; @@ -333,7 +445,8 @@ out: int32_t -client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) +client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, + off_t offset, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -346,6 +459,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) args.fd = fd; args.offset = offset; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FTRUNCATE]; if (!proc) { @@ -358,7 +472,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -366,7 +480,8 @@ out: int32_t -client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) +client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, + int32_t mask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -379,6 +494,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) args.loc = loc; args.mask = mask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ACCESS]; if (!proc) { @@ -391,7 +507,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN, NULL); return 0; } @@ -400,7 +516,8 @@ out: int32_t -client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) +client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, + size_t size, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -413,6 +530,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) args.loc = loc; args.size = size; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READLINK]; if (!proc) { @@ -425,7 +543,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -433,7 +551,7 @@ out: int client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, dict_t *params) + dev_t rdev, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -447,7 +565,8 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, args.loc = loc; args.mode = mode; args.rdev = rdev; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKNOD]; if (!proc) { @@ -461,7 +580,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, out: if (ret) STACK_UNWIND_STRICT (mknod, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -469,7 +588,7 @@ out: int client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, - mode_t mode, dict_t *params) + mode_t mode, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -482,7 +601,8 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.mode = mode; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKDIR]; if (!proc) { @@ -496,7 +616,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) STACK_UNWIND_STRICT (mkdir, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -504,7 +624,8 @@ out: int32_t -client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, + int xflag, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -516,6 +637,8 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; + args.flags = xflag; proc = &conf->fops->proctable[GF_FOP_UNLINK]; if (!proc) { @@ -529,13 +652,14 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) out: if (ret) STACK_UNWIND_STRICT (unlink, frame, -1, ENOTCONN, - NULL, NULL); + NULL, NULL, NULL); return 0; } int32_t -client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) +client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -548,6 +672,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) args.loc = loc; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RMDIR]; if (!proc) { @@ -562,7 +687,7 @@ out: /* think of avoiding a missing frame */ if (ret) STACK_UNWIND_STRICT (rmdir, frame, -1, ENOTCONN, - NULL, NULL); + NULL, NULL, NULL); return 0; } @@ -570,7 +695,7 @@ out: int client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc, dict_t *params) + loc_t *loc, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -583,7 +708,8 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, args.linkname = linkpath; args.loc = loc; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SYMLINK]; if (!proc) { @@ -597,7 +723,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, out: if (ret) STACK_UNWIND_STRICT (symlink, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -606,7 +732,7 @@ out: int32_t client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc) + loc_t *newloc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -619,6 +745,8 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.oldloc = oldloc; args.newloc = newloc; + args.xdata = xdata; + proc = &conf->fops->proctable[GF_FOP_RENAME]; if (!proc) { gf_log (this->name, GF_LOG_ERROR, @@ -631,7 +759,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, out: if (ret) STACK_UNWIND_STRICT (rename, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -640,7 +768,7 @@ out: int32_t client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc) + loc_t *newloc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -653,6 +781,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.oldloc = oldloc; args.newloc = newloc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LINK]; if (!proc) { @@ -666,7 +795,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, out: if (ret) STACK_UNWIND_STRICT (link, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -674,8 +803,8 @@ out: int32_t -client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, mode_t mode, fd_t *fd, dict_t *params) +client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -687,10 +816,15 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, goto out; args.loc = loc; - args.flags = flags; args.mode = mode; args.fd = fd; - args.dict = params; + args.umask = umask; + args.xdata = xdata; + + if (!conf->filter_o_direct) + args.flags = flags; + else + args.flags = (flags & ~O_DIRECT); proc = &conf->fops->proctable[GF_FOP_CREATE]; if (!proc) { @@ -704,7 +838,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) STACK_UNWIND_STRICT (create, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -713,7 +847,7 @@ out: int32_t client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd, int32_t wbflags) + int32_t flags, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -725,9 +859,13 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, goto out; args.loc = loc; - args.flags = flags; args.fd = fd; - args.wbflags = wbflags; + args.xdata = xdata; + + if (!conf->filter_o_direct) + args.flags = flags; + else + args.flags = (flags & ~O_DIRECT); proc = &conf->fops->proctable[GF_FOP_OPEN]; if (!proc) { @@ -741,7 +879,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) - STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -750,7 +888,7 @@ out: int32_t client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset) + off_t offset, uint32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -764,6 +902,8 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, args.fd = fd; args.size = size; args.offset = offset; + args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READ]; if (!proc) { @@ -778,7 +918,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, out: if (ret) STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN, - NULL, 0, NULL, NULL); + NULL, 0, NULL, NULL, NULL); return 0; } @@ -789,7 +929,7 @@ out: int32_t client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t off, - struct iobref *iobref) + uint32_t flags, struct iobref *iobref, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -804,7 +944,10 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, args.vector = vector; args.count = count; args.offset = off; + args.size = iov_length (vector, count); + args.flags = flags; args.iobref = iobref; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_WRITE]; if (!proc) { @@ -817,15 +960,14 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } - int32_t -client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) +client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -837,6 +979,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) goto out; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FLUSH]; if (!proc) { @@ -849,7 +992,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN, NULL); return 0; } @@ -858,7 +1001,7 @@ out: int32_t client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags) + int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -871,6 +1014,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNC]; if (!proc) { @@ -883,7 +1027,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -891,7 +1035,7 @@ out: int32_t -client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) +client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -903,6 +1047,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) goto out; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSTAT]; if (!proc) { @@ -915,7 +1060,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -923,7 +1068,8 @@ out: int32_t -client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) +client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -936,6 +1082,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) args.loc = loc; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_OPENDIR]; if (!proc) { @@ -948,7 +1095,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -956,7 +1103,7 @@ out: int32_t -client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) +client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -969,6 +1116,7 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) args.fd = fd; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNCDIR]; if (!proc) { @@ -981,7 +1129,7 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN, NULL); return 0; } @@ -989,7 +1137,7 @@ out: int32_t -client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1001,6 +1149,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STATFS]; if (!proc) { @@ -1013,7 +1162,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1072,7 +1221,6 @@ out: static gf_boolean_t client_set_remote_options (char *value, xlator_t *this) { - clnt_conf_t *conf = NULL; char *dup_value = NULL; char *host = NULL; char *subvol = NULL; @@ -1083,8 +1231,6 @@ client_set_remote_options (char *value, xlator_t *this) int remote_port = 0; gf_boolean_t ret = _gf_false; - conf = this->private; - dup_value = gf_strdup (value); host = strtok_r (dup_value, ":", &tmp); subvol = strtok_r (NULL, ":", &tmp); @@ -1133,8 +1279,7 @@ client_set_remote_options (char *value, xlator_t *this) ret = _gf_true; out: - if (dup_value) - GF_FREE (dup_value); + GF_FREE (dup_value); return ret; } @@ -1142,7 +1287,7 @@ out: int32_t client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, - int32_t flags) + int32_t flags, dict_t *xdata) { int ret = -1; int op_ret = -1; @@ -1158,8 +1303,10 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, GF_ASSERT (value); gf_log (this->name, GF_LOG_INFO, "client rpc init command"); ret = client_set_remote_options (value, this); - if (ret) + if (ret) { + (void) client_destroy_rpc (this); ret = client_init_rpc (this); + } if (!ret) { op_ret = 0; @@ -1188,8 +1335,9 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, } args.loc = loc; - args.dict = dict; + args.xattr = dict; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETXATTR]; if (!proc) { @@ -1206,7 +1354,7 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, } out: if (need_unwind) - STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno); + STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL); return 0; } @@ -1215,7 +1363,7 @@ out: int32_t client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - dict_t *dict, int32_t flags) + dict_t *dict, int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1226,9 +1374,10 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (!conf || !conf->fops) goto out; - args.fd = fd; - args.dict = dict; + args.fd = fd; + args.xattr = dict; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETXATTR]; if (!proc) { @@ -1241,7 +1390,7 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN, NULL); return 0; } @@ -1251,7 +1400,7 @@ out: int32_t client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1264,6 +1413,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.name = name; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FGETXATTR]; if (!proc) { @@ -1276,7 +1426,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1285,7 +1435,7 @@ out: int32_t client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1298,6 +1448,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.name = name; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_GETXATTR]; if (!proc) { @@ -1310,7 +1461,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1319,7 +1470,7 @@ out: int32_t client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t flags, dict_t *dict) + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1332,7 +1483,8 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.flags = flags; - args.dict = dict; + args.xattr = dict; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_XATTROP]; if (!proc) { @@ -1345,7 +1497,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1354,7 +1506,7 @@ out: int32_t client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t flags, dict_t *dict) + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1367,7 +1519,8 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.flags = flags; - args.dict = dict; + args.xattr = dict; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FXATTROP]; if (!proc) { @@ -1380,7 +1533,7 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1389,7 +1542,7 @@ out: int32_t client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1402,6 +1555,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.name = name; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR]; if (!proc) { @@ -1414,15 +1568,47 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN, NULL); return 0; } +int32_t +client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, + const char *name, dict_t *xdata) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + rpc_clnt_procedure_t *proc = NULL; + clnt_args_t args = {0,}; + + conf = this->private; + if (!conf || !conf->fops) + goto out; + + args.name = name; + args.fd = fd; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR]; + if (!proc) { + gf_log (this->name, GF_LOG_ERROR, + "rpc procedure not found for %s", + gf_fop_list[GF_FOP_FREMOVEXATTR]); + goto out; + } + if (proc->fn) + ret = proc->fn (frame, this, &args); +out: + if (ret) + STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN, NULL); + + return 0; +} int32_t client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct gf_flock *lock) + struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1436,6 +1622,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, args.fd = fd; args.cmd = cmd; args.flock = lock; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LK]; if (!proc) { @@ -1448,7 +1635,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1456,7 +1643,7 @@ out: int32_t client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct gf_flock *lock) + loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1471,6 +1658,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.cmd = cmd; args.flock = lock; args.volume = volume; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_INODELK]; if (!proc) { @@ -1483,7 +1671,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1492,7 +1680,7 @@ out: int32_t client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, - fd_t *fd, int32_t cmd, struct gf_flock *lock) + fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1507,6 +1695,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.cmd = cmd; args.flock = lock; args.volume = volume; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FINODELK]; if (!proc) { @@ -1519,7 +1708,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1528,7 +1717,7 @@ out: int32_t client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, - entrylk_type type) + entrylk_type type, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1544,6 +1733,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.type = type; args.volume = volume; args.cmd_entrylk = cmd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ENTRYLK]; if (!proc) { @@ -1556,7 +1746,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1566,7 +1756,7 @@ out: int32_t client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, - entrylk_type type) + entrylk_type type, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1582,6 +1772,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.type = type; args.volume = volume; args.cmd_entrylk = cmd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FENTRYLK]; if (!proc) { @@ -1594,7 +1785,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1602,7 +1793,7 @@ out: int32_t client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - int32_t len) + int32_t len, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1616,6 +1807,7 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, args.fd = fd; args.offset = offset; args.len = len; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RCHECKSUM]; if (!proc) { @@ -1628,14 +1820,14 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL); + STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL); return 0; } int32_t client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t off) + size_t size, off_t off, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1649,6 +1841,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.size = size; args.offset = off; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READDIR]; if (!proc) { @@ -1661,7 +1854,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1669,7 +1862,7 @@ out: int32_t client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t off) + size_t size, off_t off, dict_t *dict) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1683,6 +1876,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.size = size; args.offset = off; + args.xdata = dict; proc = &conf->fops->proctable[GF_FOP_READDIRP]; if (!proc) { @@ -1695,7 +1889,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1703,7 +1897,7 @@ out: int32_t client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1717,6 +1911,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.stbuf = stbuf; args.valid = valid; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETATTR]; if (!proc) { @@ -1729,14 +1924,14 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } int32_t client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iatt *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1750,6 +1945,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.stbuf = stbuf; args.valid = valid; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETATTR]; if (!proc) { @@ -1762,11 +1958,147 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL); + + return 0; +} + +int32_t +client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + rpc_clnt_procedure_t *proc = NULL; + clnt_args_t args = {0,}; + + conf = this->private; + if (!conf || !conf->fops) + goto out; + + args.fd = fd; + args.flags = mode; + args.offset = offset; + args.size = len; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_FALLOCATE]; + if (!proc) { + gf_log (this->name, GF_LOG_ERROR, + "rpc procedure not found for %s", + gf_fop_list[GF_FOP_FALLOCATE]); + goto out; + } + if (proc->fn) + ret = proc->fn (frame, this, &args); +out: + if (ret) + STACK_UNWIND_STRICT (fallocate, frame, -1, ENOTCONN, NULL, NULL, NULL); + + return 0; +} + +int32_t +client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + size_t len, dict_t *xdata) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + rpc_clnt_procedure_t *proc = NULL; + clnt_args_t args = {0,}; + + conf = this->private; + if (!conf || !conf->fops) + goto out; + + args.fd = fd; + args.offset = offset; + args.size = len; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_DISCARD]; + if (!proc) { + gf_log (this->name, GF_LOG_ERROR, + "rpc procedure not found for %s", + gf_fop_list[GF_FOP_DISCARD]); + goto out; + } + if (proc->fn) + ret = proc->fn (frame, this, &args); +out: + if (ret) + STACK_UNWIND_STRICT(discard, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } +int32_t +client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + off_t len, dict_t *xdata) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + rpc_clnt_procedure_t *proc = NULL; + clnt_args_t args = {0,}; + + conf = this->private; + if (!conf || !conf->fops) + goto out; + + args.fd = fd; + args.offset = offset; + args.size = len; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_ZEROFILL]; + if (!proc) { + gf_log (this->name, GF_LOG_ERROR, + "rpc procedure not found for %s", + gf_fop_list[GF_FOP_ZEROFILL]); + goto out; + } + if (proc->fn) + ret = proc->fn (frame, this, &args); +out: + if (ret) + STACK_UNWIND_STRICT(zerofill, frame, -1, ENOTCONN, + NULL, NULL, NULL); + + return 0; +} + + +int32_t +client_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata) +{ + int ret = -1; + clnt_conf_t *conf = NULL; + rpc_clnt_procedure_t *proc = NULL; + clnt_args_t args = {0,}; + + conf = this->private; + if (!conf || !conf->fops) + goto out; + + args.cmd = op; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_IPC]; + if (!proc) { + gf_log (this->name, GF_LOG_ERROR, + "rpc procedure not found for %s", + gf_fop_list[GF_FOP_IPC]); + goto out; + } + if (proc->fn) + ret = proc->fn (frame, this, &args); +out: + if (ret) + STACK_UNWIND_STRICT(ipc, frame, -1, ENOTCONN, NULL); + + return 0; +} + int32_t client_getspec (call_frame_t *frame, xlator_t *this, const char *key, @@ -1804,7 +2136,7 @@ out: } - int +int client_mark_fd_bad (xlator_t *this) { clnt_conf_t *conf = NULL; @@ -1856,7 +2188,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); if ((ret < 0) || (strcasecmp (handshake, "on"))) { - ret = client_handshake (this, conf->rpc); + ret = client_handshake (this, rpc); if (ret) gf_log (this->name, GF_LOG_WARNING, "handshake msg returned %d", ret); @@ -1871,16 +2203,46 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, conf->last_sent_event = GF_EVENT_CHILD_UP; } } + + /* Cancel grace timer if set */ + pthread_mutex_lock (&conf->lock); + { + conf->grace_timer_needed = _gf_true; + + if (conf->grace_timer) { + gf_log (this->name, GF_LOG_WARNING, + "Cancelling the grace timer"); + + gf_timer_call_cancel (this->ctx, + conf->grace_timer); + + conf->grace_timer = NULL; + } + } + pthread_mutex_unlock (&conf->lock); + break; } case RPC_CLNT_DISCONNECT: - - client_mark_fd_bad (this); + if (!conf->lk_heal) + client_mark_fd_bad (this); + else + client_register_grace_timer (this, conf); if (!conf->skip_notify) { - if (conf->connected) - gf_log (this->name, GF_LOG_INFO, - "disconnected"); + if (conf->connected) { + gf_log (this->name, + ((!conf->disconnect_err_logged) + ? GF_LOG_INFO : GF_LOG_DEBUG), + "disconnected from %s. Client process " + "will keep trying to connect to " + "glusterd until brick's port is " + "available", + conf->rpc->conn.name); + + if (conf->portmap_err_logged) + conf->disconnect_err_logged = 1; + } /* If the CHILD_DOWN event goes to parent xlator multiple times, the logic of parent xlator notify @@ -1904,6 +2266,15 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, conf->connected = 0; conf->skip_notify = 0; + if (conf->quick_reconnect) { + conf->quick_reconnect = 0; + rpc_clnt_start (rpc); + + } else { + rpc->conn.config.remote_port = 0; + + } + break; default: @@ -1921,7 +2292,7 @@ out: int notify (xlator_t *this, int32_t event, void *data, ...) { - clnt_conf_t *conf = NULL; + clnt_conf_t *conf = NULL; conf = this->private; if (!conf) @@ -1935,8 +2306,22 @@ notify (xlator_t *this, int32_t event, void *data, ...) "on transport"); rpc_clnt_start (conf->rpc); + break; } - break; + + case GF_EVENT_PARENT_DOWN: + gf_log (this->name, GF_LOG_INFO, + "current graph is no longer active, destroying " + "rpc_client "); + + pthread_mutex_lock (&conf->lock); + { + conf->parent_down = 1; + } + pthread_mutex_unlock (&conf->lock); + + rpc_clnt_disable (conf->rpc); + break; default: gf_log (this->name, GF_LOG_DEBUG, @@ -1953,53 +2338,28 @@ notify (xlator_t *this, int32_t event, void *data, ...) int build_client_config (xlator_t *this, clnt_conf_t *conf) { - int ret = -1; + int ret = -1; if (!conf) goto out; - ret = dict_get_int32 (this->options, "frame-timeout", - &conf->rpc_conf.rpc_timeout); - if (ret >= 0) { - gf_log (this->name, GF_LOG_INFO, - "setting frame-timeout to %d", - conf->rpc_conf.rpc_timeout); - } else { - gf_log (this->name, GF_LOG_DEBUG, - "defaulting frame-timeout to 30mins"); - conf->rpc_conf.rpc_timeout = 1800; - } + GF_OPTION_INIT ("frame-timeout", conf->rpc_conf.rpc_timeout, + int32, out); - ret = dict_get_int32 (this->options, "remote-port", - &conf->rpc_conf.remote_port); - if (ret >= 0) { - gf_log (this->name, GF_LOG_INFO, - "remote-port is %d", conf->rpc_conf.remote_port); - } else { - gf_log (this->name, GF_LOG_DEBUG, - "defaulting remote-port to 'auto'"); - } + GF_OPTION_INIT ("remote-port", conf->rpc_conf.remote_port, + int32, out); - ret = dict_get_int32 (this->options, "ping-timeout", - &conf->opt.ping_timeout); - if (ret >= 0) { - gf_log (this->name, GF_LOG_INFO, - "setting ping-timeout to %d", conf->opt.ping_timeout); - } else { - gf_log (this->name, GF_LOG_DEBUG, - "defaulting ping-timeout to 42"); - conf->opt.ping_timeout = GF_UNIVERSAL_ANSWER; - } + GF_OPTION_INIT ("ping-timeout", conf->opt.ping_timeout, + int32, out); - ret = dict_get_str (this->options, "remote-subvolume", - &conf->opt.remote_subvolume); - if (ret) { - /* This is valid only if 'cluster/pump' is the parent */ + GF_OPTION_INIT ("remote-subvolume", conf->opt.remote_subvolume, + path, out); + if (!conf->opt.remote_subvolume) gf_log (this->name, GF_LOG_WARNING, "option 'remote-subvolume' not given"); - ret = 1; - goto out; - } + + GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct, + bool, out); ret = 0; out: @@ -2037,6 +2397,9 @@ client_destroy_rpc (xlator_t *this) goto out; if (conf->rpc) { + /* cleanup the saved-frames before last unref */ + rpc_clnt_connection_cleanup (&conf->rpc->conn); + conf->rpc = rpc_clnt_unref (conf->rpc); ret = 0; gf_log (this->name, GF_LOG_DEBUG, @@ -2045,7 +2408,7 @@ client_destroy_rpc (xlator_t *this) } gf_log (this->name, GF_LOG_WARNING, - "RPC destory called on already destroyed " + "RPC destroy called on already destroyed " "connection"); out: @@ -2067,7 +2430,7 @@ client_init_rpc (xlator_t *this) goto out; } - conf->rpc = rpc_clnt_new (this->options, this->ctx, this->name); + conf->rpc = rpc_clnt_new (this->options, this->ctx, this->name, 0); if (!conf->rpc) { gf_log (this->name, GF_LOG_ERROR, "failed to initialize RPC"); goto out; @@ -2082,7 +2445,8 @@ client_init_rpc (xlator_t *this) conf->handshake = &clnt_handshake_prog; conf->dump = &clnt_dump_prog; - ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog); + ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog, + this); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to register callback program"); @@ -2096,32 +2460,41 @@ out: return ret; } + int -validate_options (xlator_t *this, char **op_errstr) +client_init_grace_timer (xlator_t *this, dict_t *options, + clnt_conf_t *conf) { - int ret = 0; - volume_opt_list_t *vol_opt = NULL; - volume_opt_list_t *tmp; + char *lk_heal = NULL; + int32_t ret = -1; + int32_t grace_timeout = -1; - if (!this) { - gf_log (this->name, GF_LOG_DEBUG, "'this' not a valid ptr"); - ret =-1; - goto out; - } + GF_VALIDATE_OR_GOTO ("client", this, out); + GF_VALIDATE_OR_GOTO (this->name, options, out); + GF_VALIDATE_OR_GOTO (this->name, conf, out); - if (list_empty (&this->volume_options)) - goto out; + conf->lk_heal = _gf_false; - vol_opt = list_entry (this->volume_options.next, - volume_opt_list_t, list); - list_for_each_entry_safe (vol_opt, tmp, &this->volume_options, list) { - ret = validate_xlator_volume_options_attacherr (this, - vol_opt->given_opt, - op_errstr); - } + ret = dict_get_str (options, "lk-heal", &lk_heal); + if (!ret) + gf_string2boolean (lk_heal, &conf->lk_heal); -out: + gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s", + (conf->lk_heal) ? "on" : "off"); + + ret = dict_get_int32 (options, "grace-timeout", &grace_timeout); + if (!ret) + conf->grace_ts.tv_sec = grace_timeout; + else + conf->grace_ts.tv_sec = 10; + + conf->grace_ts.tv_nsec = 0; + gf_log (this->name, GF_LOG_DEBUG, "Client grace timeout " + "value = %"GF_PRI_SECOND, conf->grace_ts.tv_sec); + + ret = 0; +out: return ret; } @@ -2129,10 +2502,7 @@ int reconfigure (xlator_t *this, dict_t *options) { clnt_conf_t *conf = NULL; - int ret = 0; - int timeout_ret = 0; - int ping_timeout = 0; - int frame_timeout = 0; + int ret = -1; int subvol_ret = 0; char *old_remote_subvol = NULL; char *new_remote_subvol = NULL; @@ -2141,70 +2511,18 @@ reconfigure (xlator_t *this, dict_t *options) conf = this->private; - timeout_ret = dict_get_int32 (options, "frame-timeout", - &frame_timeout); - if (timeout_ret == 0) { - if (frame_timeout < 5 ) { - gf_log (this->name, GF_LOG_ERROR, "Reconfiguration" - "'option frame-timeout %d failed , Min value" - " can be 5, Defaulting to old value (%d)" - , frame_timeout, conf->rpc_conf.rpc_timeout); - goto out; - } - - if (frame_timeout > 3600 ) { - gf_log (this->name, GF_LOG_ERROR, "Reconfiguration" - "'option frame-timeout %d failed , Max value" - "can be 3600, Defaulting to old value (%d)" - , frame_timeout, conf->rpc_conf.rpc_timeout); - goto out; - } + GF_OPTION_RECONF ("frame-timeout", conf->rpc_conf.rpc_timeout, + options, int32, out); - - gf_log (this->name, GF_LOG_DEBUG, - "Reconfiguring otion frame-timeout to %d", - frame_timeout); - - conf->rpc_conf.rpc_timeout = frame_timeout; - } - else - conf->rpc_conf.rpc_timeout = 1800; - - timeout_ret = dict_get_int32 (options, "ping-timeout", - &ping_timeout); - if (timeout_ret == 0) { - - if (ping_timeout < 5 ) { - gf_log (this->name, GF_LOG_WARNING, "Reconfiguration" - "'option ping-timeout %d failed , Min value" - " can be 5, Defaulting to old value (%d)" - , ping_timeout, conf->opt.ping_timeout); - goto out; - } - - if (ping_timeout > 1013 ) { - gf_log (this->name, GF_LOG_WARNING, "Reconfiguration" - "'option ping-timeout %d failed , Max value" - "can be 1013, Defaulting to old value (%d)" - , ping_timeout, conf->opt.ping_timeout); - goto out; - } - - gf_log (this->name, GF_LOG_DEBUG, "Reconfiguring " - "'option ping-timeout' to %d", ping_timeout); - conf->opt.ping_timeout = ping_timeout; - } - else - conf->opt.ping_timeout = GF_UNIVERSAL_ANSWER; + GF_OPTION_RECONF ("ping-timeout", conf->opt.ping_timeout, + options, int32, out); subvol_ret = dict_get_str (this->options, "remote-host", &old_remote_host); if (subvol_ret == 0) { - subvol_ret = dict_get_str (options, "remote-host", &new_remote_host); - if (subvol_ret == 0) { if (strcmp (old_remote_host, new_remote_host)) { ret = 1; @@ -2217,10 +2535,8 @@ reconfigure (xlator_t *this, dict_t *options) &old_remote_subvol); if (subvol_ret == 0) { - subvol_ret = dict_get_str (options, "remote-subvolume", &new_remote_subvol); - if (subvol_ret == 0) { if (strcmp (old_remote_subvol, new_remote_subvol)) { ret = 1; @@ -2229,18 +2545,26 @@ reconfigure (xlator_t *this, dict_t *options) } } + GF_OPTION_RECONF ("filter-O_DIRECT", conf->filter_o_direct, + options, bool, out); + + ret = client_init_grace_timer (this, options, conf); + if (ret) + goto out; + + ret = 0; out: return ret; } + int init (xlator_t *this) { int ret = -1; clnt_conf_t *conf = NULL; - /* */ if (this->children) { gf_log (this->name, GF_LOG_ERROR, "FATAL: client protocol translator cannot have any " @@ -2260,6 +2584,15 @@ init (xlator_t *this) pthread_mutex_init (&conf->lock, NULL); INIT_LIST_HEAD (&conf->saved_fds); + /* Initialize parameters for lock self healing*/ + conf->lk_version = 1; + conf->grace_timer = NULL; + conf->grace_timer_needed = _gf_true; + + ret = client_init_grace_timer (this, this->options, conf); + if (ret) + goto out; + LOCK_INIT (&conf->rec_lock); conf->last_sent_event = -1; /* To start with we don't have any events */ @@ -2281,6 +2614,13 @@ init (xlator_t *this) goto out; } + this->local_pool = mem_pool_new (clnt_local_t, 64); + if (!this->local_pool) { + ret = -1; + gf_log (this->name, GF_LOG_ERROR, + "failed to create local_t's memory pool"); + goto out; + } ret = client_init_rpc (this); out: @@ -2299,8 +2639,12 @@ fini (xlator_t *this) this->private = NULL; if (conf) { - if (conf->rpc) - rpc_clnt_unref (conf->rpc); + if (conf->rpc) { + /* cleanup the saved-frames before last unref */ + rpc_clnt_connection_cleanup (&conf->rpc->conn); + + rpc_clnt_unref (conf->rpc); + } /* Saved Fds */ /* TODO: */ @@ -2312,6 +2656,54 @@ fini (xlator_t *this) return; } +static void +client_fd_lk_ctx_dump (xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd) +{ + gf_boolean_t use_try_lock = _gf_true; + int ret = -1; + int lock_no = 0; + fd_lk_ctx_t *lk_ctx_ref = NULL; + fd_lk_ctx_node_t *plock = NULL; + char key[GF_DUMP_MAX_BUF_LEN] = {0,}; + + lk_ctx_ref = fd_lk_ctx_try_ref (lk_ctx); + if (!lk_ctx_ref) + return; + + ret = client_fd_lk_list_empty (lk_ctx_ref, (use_try_lock = _gf_true)); + if (ret != 0) + return; + + ret = TRY_LOCK (&lk_ctx_ref->lock); + if (ret) + return; + + gf_proc_dump_write ("------","------"); + + lock_no = 0; + list_for_each_entry (plock, &lk_ctx_ref->lk_list, next) { + snprintf (key, sizeof (key), "granted-posix-lock[%d]", + lock_no++); + gf_proc_dump_write (key, "owner = %s, cmd = %s " + "fl_type = %s, fl_start = %" + PRId64", fl_end = %"PRId64 + ", user_flock: l_type = %s, " + "l_start = %"PRId64", l_len = %"PRId64, + lkowner_utoa (&plock->user_flock.l_owner), + get_lk_cmd (plock->cmd), + get_lk_type (plock->fl_type), + plock->fl_start, plock->fl_end, + get_lk_type (plock->user_flock.l_type), + plock->user_flock.l_start, + plock->user_flock.l_len); + } + gf_proc_dump_write ("------","------"); + + UNLOCK (&lk_ctx_ref->lock); + fd_lk_ctx_unref (lk_ctx_ref); + +} + int client_priv_dump (xlator_t *this) { @@ -2326,18 +2718,12 @@ client_priv_dump (xlator_t *this) return -1; conf = this->private; - if (!conf) { - gf_log (this->name, GF_LOG_WARNING, - "conf null in xlator"); + if (!conf) return -1; - } ret = pthread_mutex_trylock(&conf->lock); - if (ret) { - gf_log(this->name, GF_LOG_WARNING, "Unable to lock client %s" - " errno: %d", this->name, errno); + if (ret) return -1; - } gf_proc_dump_build_key(key_prefix, "xlator.protocol.client", "%s.priv", this->name); @@ -2345,25 +2731,19 @@ client_priv_dump (xlator_t *this) gf_proc_dump_add_section(key_prefix); list_for_each_entry(tmp, &conf->saved_fds, sfd_pos) { - gf_proc_dump_build_key(key, key_prefix, - "fd.%d.remote_fd", ++i); + sprintf (key, "fd.%d.remote_fd", i); gf_proc_dump_write(key, "%d", tmp->remote_fd); + client_fd_lk_ctx_dump (this, tmp->lk_ctx, i); + i++; } - gf_proc_dump_build_key(key, key_prefix, "connecting"); - gf_proc_dump_write(key, "%d", conf->connecting); - gf_proc_dump_build_key(key, key_prefix, "last_sent"); - gf_proc_dump_write(key, "%s", ctime(&conf->last_sent.tv_sec)); - gf_proc_dump_build_key(key, key_prefix, "last_received"); - gf_proc_dump_write(key, "%s", ctime(&conf->last_received.tv_sec)); + gf_proc_dump_write("connecting", "%d", conf->connecting); if (conf->rpc) { - gf_proc_dump_build_key(key, key_prefix, "total_bytes_read"); - gf_proc_dump_write(key, "%"PRIu64, + gf_proc_dump_write("total_bytes_read", "%"PRIu64, conf->rpc->conn.trans->total_bytes_read); - gf_proc_dump_build_key(key, key_prefix, "total_bytes_written"); - gf_proc_dump_write(key, "%"PRIu64, + gf_proc_dump_write("total_bytes_written", "%"PRIu64, conf->rpc->conn.trans->total_bytes_write); } pthread_mutex_unlock(&conf->lock); @@ -2375,26 +2755,13 @@ client_priv_dump (xlator_t *this) int32_t client_inodectx_dump (xlator_t *this, inode_t *inode) { - ino_t par = 0; - uint64_t gen = 0; - int ret = -1; - char key[GF_DUMP_MAX_BUF_LEN]; - if (!inode) return -1; if (!this) return -1; - ret = inode_ctx_get2 (inode, this, &par, &gen); - - if (ret != 0) - return ret; - - gf_proc_dump_build_key(key, "xlator.protocol.client", - "%s.inode.%ld.par", - this->name,inode->ino); - gf_proc_dump_write(key, "%ld, %ld", par, gen); + /*TODO*/ return 0; } @@ -2430,6 +2797,7 @@ struct xlator_fops fops = { .fsetxattr = client_fsetxattr, .fgetxattr = client_fgetxattr, .removexattr = client_removexattr, + .fremovexattr = client_fremovexattr, .opendir = client_opendir, .readdir = client_readdir, .readdirp = client_readdirp, @@ -2449,7 +2817,11 @@ struct xlator_fops fops = { .fxattrop = client_fxattrop, .setattr = client_setattr, .fsetattr = client_fsetattr, + .fallocate = client_fallocate, + .discard = client_discard, + .zerofill = client_zerofill, .getspec = client_getspec, + .ipc = client_ipc, }; @@ -2474,6 +2846,9 @@ struct volume_options options[] = { { .key = {"remote-host"}, .type = GF_OPTION_TYPE_INTERNET_ADDRESS }, + { .key = {"remote-port"}, + .type = GF_OPTION_TYPE_INT, + }, { .key = {"remote-subvolume"}, .type = GF_OPTION_TYPE_ANY }, @@ -2482,11 +2857,52 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_TIME, .min = 0, .max = 86400, + .default_value = "1800", + .description = "Time frame after which the (file) operation would be " + "declared as dead, if the server does not respond for " + "a particular (file) operation." }, { .key = {"ping-timeout"}, .type = GF_OPTION_TYPE_TIME, .min = 1, .max = 1013, + .default_value = "42", + .description = "Time duration for which the client waits to " + "check if the server is responsive." + }, + { .key = {"client-bind-insecure"}, + .type = GF_OPTION_TYPE_BOOL + }, + { .key = {"lk-heal"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "When the connection to client is lost, server " + "cleans up all the locks held by the client. After " + "the connection is restored, the client reacquires " + "(heals) the fcntl locks released by the server." + }, + { .key = {"grace-timeout"}, + .type = GF_OPTION_TYPE_INT, + .min = 10, + .max = 1800, + .default_value = "10", + .description = "Specifies the duration for the lock state to be " + "maintained on the client after a network " + "disconnection. Range 10-1800 seconds." + }, + {.key = {"tcp-window-size"}, + .type = GF_OPTION_TYPE_SIZET, + .min = GF_MIN_SOCKET_WINDOW_SIZE, + .max = GF_MAX_SOCKET_WINDOW_SIZE, + .description = "Specifies the window size for tcp socket." + }, + { .key = {"filter-O_DIRECT"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "disable", + .description = "If enabled, in open() and creat() calls, O_DIRECT " + "flag will be filtered at the client protocol level so server will " + "still continue to cache the file. This works similar to NFS's " + "behavior of O_DIRECT", }, { .key = {NULL} }, }; |
