summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2015-10-15 15:04:34 +0530
committerRaghavendra G <rgowdapp@redhat.com>2018-01-29 17:36:31 +0000
commit3e78ea991b213422fc423ff94994e1eb295569c7 (patch)
tree4eb9bfc9e9a60a816a59d1e0215ee560e30f118a /xlators/protocol/client
parent596143a286079338c30c8abc4b862f8d6ddddb3a (diff)
protocol: Remove lock recovery logic from client and server
Change-Id: I27f5e1e34fe3eac96c7dd88e90753fb5d3d14550 BUG: 1272030 Signed-off-by: Anoop C S <anoopcs@redhat.com>
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client-handshake.c365
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c19
-rw-r--r--xlators/protocol/client/src/client-rpc-fops_v2.c18
-rw-r--r--xlators/protocol/client/src/client.c177
-rw-r--r--xlators/protocol/client/src/client.h24
5 files changed, 14 insertions, 589 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 2d779fa..fe6e923 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -27,11 +27,6 @@ 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,
- int count, void *myframe);
-
-int client_set_lk_version (xlator_t *this);
-
typedef struct client_fd_lk_local {
gf_atomic_t ref;
gf_boolean_t error;
@@ -168,7 +163,6 @@ clnt_fd_lk_reacquire_failed (xlator_t *this, clnt_fd_ctx_t *fdctx,
pthread_spin_lock (&conf->fd_lock);
{
fdctx->remote_fd = -1;
- fdctx->lk_heal_state = GF_LK_HEAL_DONE;
}
pthread_spin_unlock (&conf->fd_lock);
@@ -178,90 +172,6 @@ out:
}
int
-client_set_lk_version_cbk (struct rpc_req *req, struct iovec *iov,
- int count, void *myframe)
-{
- int32_t ret = -1;
- call_frame_t *fr = NULL;
- gf_set_lk_ver_rsp rsp = {0,};
-
- fr = (call_frame_t *) myframe;
- GF_VALIDATE_OR_GOTO ("client", fr, out);
-
- if (req->rpc_status == -1) {
- gf_msg (fr->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_set_lk_ver_rsp);
- if (ret < 0)
- gf_msg (fr->this->name, GF_LOG_WARNING, 0,
- PC_MSG_XDR_DECODING_FAILED, "xdr decoding failed");
- else
- gf_msg (fr->this->name, GF_LOG_INFO, 0,
- PC_MSG_LOCK_VERSION_SERVER,
- "Server lk version = %d", rsp.lk_ver);
-
- ret = 0;
-out:
- if (fr)
- STACK_DESTROY (fr->root);
-
- return ret;
-}
-
-//TODO: Check for all released fdctx and destroy them
-int
-client_set_lk_version (xlator_t *this)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- call_frame_t *frame = NULL;
- gf_set_lk_ver_req req = {0, };
- char *process_uuid = NULL;
-
- GF_VALIDATE_OR_GOTO ("client", this, err);
-
- conf = (clnt_conf_t *) this->private;
-
- req.lk_ver = client_get_lk_ver (conf);
- ret = dict_get_str (this->options, "process-uuid", &process_uuid);
- if (!process_uuid) {
- ret = -1;
- goto err;
- }
- req.uid = gf_strdup (process_uuid);
- if (!req.uid) {
- ret = -1;
- goto err;
- }
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- gf_msg_debug (this->name, 0, "Sending SET_LK_VERSION");
-
- ret = client_submit_request (this, &req, frame,
- conf->handshake,
- GF_HNDSK_SET_LK_VER,
- client_set_lk_version_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_set_lk_ver_req);
-out:
- GF_FREE (req.uid);
- return ret;
-err:
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SET_LK_VERSION_ERROR,
- "Failed to send SET_LK_VERSION to server");
-
- return ret;
-}
-
-int
client_fd_lk_count (fd_lk_ctx_t *lk_ctx)
{
int count = 0;
@@ -440,186 +350,6 @@ out:
return ret;
}
-int
-client_reacquire_lock_cbk (struct rpc_req *req, struct iovec *iov,
- int count, void *myframe)
-{
- int32_t ret = -1;
- xlator_t *this = NULL;
- gfs3_lk_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_fd_lk_local_t *local = NULL;
- struct gf_flock lock = {0,};
-
- frame = (call_frame_t *) myframe;
- this = frame->this;
- local = (clnt_fd_lk_local_t *) frame->local;
- conf = (clnt_conf_t *) this->private;
-
- if (req->rpc_status == -1) {
- gf_msg ("client", GF_LOG_WARNING, 0, PC_MSG_CLIENT_REQ_FAIL,
- "request failed at rpc");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
-
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_LOCK_REQ_FAIL,
- "lock request failed");
- ret = -1;
- goto out;
- }
-
- fdctx = local->fdctx;
-
- gf_proto_flock_to_flock (&rsp.flock, &lock);
-
- gf_msg_debug (this->name, 0, "%s type lock reacquired on file "
- "with gfid %s from %"PRIu64 " to %"PRIu64,
- get_lk_type (lock.l_type), uuid_utoa (fdctx->gfid),
- lock.l_start, lock.l_start + lock.l_len);
-
- if (!clnt_fd_lk_local_error_status (this, local) &&
- clnt_fd_lk_local_unref (this, local) == 0) {
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx->lk_heal_state = GF_LK_HEAL_DONE;
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
- }
-
- ret = 0;
-out:
- if (ret < 0) {
- clnt_fd_lk_local_mark_error (this, local);
-
- clnt_fd_lk_local_unref (this, local);
- }
-
- frame->local = NULL;
- STACK_DESTROY (frame->root);
-
- return ret;
-}
-
-int
-_client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
-{
- int32_t ret = -1;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
- gfs3_lk_req req = {{0,},};
- struct gf_flock flock = {0,};
- fd_lk_ctx_t *lk_ctx = NULL;
- clnt_fd_lk_local_t *local = NULL;
- fd_lk_ctx_node_t *fd_lk = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = (clnt_conf_t *) this->private;
- lk_ctx = fdctx->lk_ctx;
-
- local = clnt_fd_lk_local_create (fdctx);
- if (!local) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_LOCK_ERROR,
- "clnt_fd_lk_local_create failed, aborting reacquring "
- "of locks on %s.", uuid_utoa (fdctx->gfid));
- clnt_reacquire_lock_error (this, fdctx, conf);
- goto out;
- }
-
- list_for_each_entry (fd_lk, &lk_ctx->lk_list, next) {
- memcpy (&flock, &fd_lk->user_flock,
- sizeof (struct gf_flock));
-
- /* Always send F_SETLK even if the cmd was F_SETLKW */
- /* to avoid frame being blocked if lock cannot be granted. */
- ret = client_cmd_to_gf_cmd (F_SETLK, &gf_cmd);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_LOCK_ERROR, "client_cmd_to_gf_cmd "
- "failed, aborting reacquiring of locks");
- break;
- }
-
- gf_type = client_type_to_gf_type (flock.l_type);
- req.fd = fdctx->remote_fd;
- req.cmd = gf_cmd;
- req.type = gf_type;
- (void) gf_proto_flock_from_flock (&req.flock,
- &flock);
-
- memcpy (req.gfid, fdctx->gfid, 16);
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- break;
- }
-
- frame->local = clnt_fd_lk_local_ref (this, local);
- frame->root->lk_owner = fd_lk->user_flock.l_owner;
-
- ret = client_submit_request (this, &req, frame,
- conf->fops, GFS3_OP_LK,
- client_reacquire_lock_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_LOCK_REACQUIRE, "reacquiring locks "
- "failed on file with gfid %s",
- uuid_utoa (fdctx->gfid));
- break;
- }
-
- ret = 0;
- frame = NULL;
- }
-
- if (local)
- (void) clnt_fd_lk_local_unref (this, local);
-out:
- return ret;
-}
-
-int
-client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
-{
- int32_t ret = -1;
- fd_lk_ctx_t *lk_ctx = NULL;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
-
- if (client_fd_lk_list_empty (fdctx->lk_ctx, _gf_false)) {
- gf_msg_debug (this->name, 0,
- "fd lock list is empty");
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
- } else {
- lk_ctx = fdctx->lk_ctx;
-
- LOCK (&lk_ctx->lock);
- {
- (void) _client_reacquire_lock (this, fdctx);
- }
- UNLOCK (&lk_ctx->lock);
- }
- ret = 0;
-out:
- return ret;
-}
-
void
client_default_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
@@ -670,7 +400,6 @@ client_child_up_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
if (fd_count == 0) {
gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
"last fd open'd/lock-self-heal'd - notifying CHILD-UP");
- client_set_lk_version (this);
client_notify_parents_child_up (this);
}
}
@@ -681,16 +410,13 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
{
int32_t ret = -1;
gfs3_open_rsp rsp = {0,};
- gf_boolean_t attempt_lock_recovery = _gf_false;
clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
clnt_fd_ctx_t *fdctx = NULL;
call_frame_t *frame = NULL;
xlator_t *this = NULL;
frame = myframe;
this = frame->this;
- conf = this->private;
local = frame->local;
fdctx = local->fdctx;
@@ -727,38 +453,10 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- pthread_spin_lock (&conf->fd_lock);
- {
- if (!fdctx->released) {
- if (conf->lk_heal &&
- !client_fd_lk_list_empty (fdctx->lk_ctx,
- _gf_false)) {
- attempt_lock_recovery = _gf_true;
- fdctx->lk_heal_state = GF_LK_HEAL_IN_PROGRESS;
- }
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
ret = 0;
- if (attempt_lock_recovery) {
- /* Delay decrementing the reopen fd count until all the
- locks corresponding to this fd are acquired.*/
- gf_msg_debug (this->name, 0, "acquiring locks "
- "on %s", local->loc.path);
- ret = client_reacquire_lock (frame->this, local->fdctx);
- if (ret) {
- clnt_reacquire_lock_error (this, local->fdctx, conf);
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_LOCK_ERROR, "acquiring locks failed "
- "on %s", local->loc.path);
- }
- }
-
out:
- if (!attempt_lock_recovery)
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
+ fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
frame->local = NULL;
STACK_DESTROY (frame->root);
@@ -1051,7 +749,6 @@ client_post_handshake (call_frame_t *frame, xlator_t *this)
gf_msg_debug (this->name, 0,
"No fds to open - notifying all parents child "
"up");
- client_set_lk_version (this);
client_notify_parents_child_up (this);
}
out:
@@ -1073,7 +770,6 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
int32_t op_ret = 0;
int32_t op_errno = 0;
gf_boolean_t auth_fail = _gf_false;
- uint32_t lk_ver = 0;
glusterfs_ctx_t *ctx = NULL;
frame = myframe;
@@ -1189,16 +885,6 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
conf->child_up = (child_up_int != 0);
}
- ret = dict_get_uint32 (reply, "clnt-lk-version", &lk_ver);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'clnt-lk-version' in the options");
- goto out;
- }
-
- gf_msg_debug (this->name, 0, "clnt-lk-version = %d, "
- "server-lk-version = %d", client_get_lk_ver (conf),
- lk_ver);
/* TODO: currently setpeer path is broken */
/*
if (process_uuid && req->conn &&
@@ -1234,22 +920,7 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
conf->connecting = 0;
conf->connected = 1;
- if (lk_ver != client_get_lk_ver (conf)) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MISMATCH,
- "Server and Client lk-version numbers are not same, "
- "reopening the fds");
- client_mark_fd_bad (this);
- client_post_handshake (frame, frame->this);
- } else {
- /*TODO: Traverse the saved fd list, and send
- release to the server on fd's that were closed
- during grace period */
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MATCH,
- "Server and Client lk-version numbers are same, no "
- "need to reopen the fds");
- client_notify_parents_child_up (frame->this);
- }
-
+ client_post_handshake (frame, frame->this);
out:
if (auth_fail) {
gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
@@ -1334,21 +1005,16 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
}
}
- /* When lock-heal is enabled:
- * With multiple graphs possible in the same process, we need a
- field to bring the uniqueness. Graph-ID should be enough to get the
- job done.
- * When lock-heal is disabled, connection-id should always be unique so
- * that server never gets to reuse the previous connection resources
- * so it cleans up the resources on every disconnect. Otherwise
- * it may lead to stale resources, i.e. leaked file desciptors,
- * inode/entry locks
- */
- if (!conf->lk_heal) {
- snprintf (counter_str, sizeof (counter_str),
+ /*
+ * Connection-id should always be unique so that server never gets to
+ * reuse the previous connection resources so it cleans up the resources
+ * on every disconnect. Otherwise it may lead to stale resources, i.e.
+ * leaked file desciptors, inode/entry locks
+ */
+
+ snprintf (counter_str, sizeof (counter_str),
"-%"PRIu64, conf->setvol_count);
- conf->setvol_count++;
- }
+ conf->setvol_count++;
if (gethostname (hostname, 256) == -1) {
gf_msg (this->name, GF_LOG_ERROR, errno,
@@ -1417,14 +1083,6 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
}
}
- ret = dict_set_int16 (options, "clnt-lk-version",
- client_get_lk_ver (conf));
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set clnt-lk-version(%"PRIu32") in handshake "
- "msg", client_get_lk_ver (conf));
- }
-
ret = dict_set_int32 (options, "opversion", GD_OP_VERSION_MAX);
if (ret < 0) {
gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
@@ -1777,7 +1435,6 @@ char *clnt_handshake_procs[GF_HNDSK_MAXVALUE] = {
[GF_HNDSK_SETVOLUME] = "SETVOLUME",
[GF_HNDSK_GETSPEC] = "GETSPEC",
[GF_HNDSK_PING] = "PING",
- [GF_HNDSK_SET_LK_VER] = "SET_LK_VER"
};
rpc_clnt_prog_t clnt_handshake_prog = {
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index ead439e..4279a32 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -363,7 +363,6 @@ client_add_fd_to_saved_fds (xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
fdctx->remote_fd = remote_fd;
fdctx->flags = flags;
fdctx->lk_ctx = fd_lk_ctx_ref (fd->lk_ctx);
- fdctx->lk_heal_state = GF_LK_HEAL_DONE;
fdctx->reopen_done = client_default_reopen_done;
INIT_LIST_HEAD (&fdctx->sfd_pos);
@@ -2437,20 +2436,6 @@ client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- /* Save the lock to the client lock cache to be able
- to recover in the case of server reboot.*/
- /*
- temporarily
- if (local->cmd == F_SETLK || local->cmd == F_SETLKW) {
- ret = client_add_lock_for_recovery (local->fd, &lock,
- local->owner, local->cmd);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- }
- }
- */
-
out:
if ((rsp.op_ret == -1) &&
(EAGAIN != gf_error_to_errno (rsp.op_errno))) {
@@ -3277,7 +3262,6 @@ client3_3_release (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_fd_ctx_t *fdctx = NULL;
clnt_args_t *args = NULL;
- lk_heal_state_t lk_heal_state = GF_LK_HEAL_DONE;
gf_boolean_t destroy = _gf_false;
if (!this || !data)
@@ -3291,7 +3275,6 @@ client3_3_release (call_frame_t *frame, xlator_t *this,
pthread_spin_lock (&conf->fd_lock);
{
remote_fd = fdctx->remote_fd;
- lk_heal_state = fdctx->lk_heal_state;
/* fdctx->remote_fd == -1 indicates a reopen attempt
in progress. Just mark ->released = 1 and let
@@ -3299,7 +3282,7 @@ client3_3_release (call_frame_t *frame, xlator_t *this,
*/
if (remote_fd == -1) {
fdctx->released = 1;
- } else if (lk_heal_state == GF_LK_HEAL_DONE) {
+ } else {
list_del_init (&fdctx->sfd_pos);
destroy = _gf_true;
}
diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c
index 4a4df47..d30d56e 100644
--- a/xlators/protocol/client/src/client-rpc-fops_v2.c
+++ b/xlators/protocol/client/src/client-rpc-fops_v2.c
@@ -2115,20 +2115,6 @@ client4_0_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- /* Save the lock to the client lock cache to be able
- to recover in the case of server reboot.*/
- /*
- temporarily
- if (local->cmd == F_SETLK || local->cmd == F_SETLKW) {
- ret = client_add_lock_for_recovery (local->fd, &lock,
- local->owner, local->cmd);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- }
- }
- */
-
out:
if ((rsp.op_ret == -1) &&
(EAGAIN != gf_error_to_errno (rsp.op_errno))) {
@@ -2782,7 +2768,6 @@ client4_0_release (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_fd_ctx_t *fdctx = NULL;
clnt_args_t *args = NULL;
- lk_heal_state_t lk_heal_state = GF_LK_HEAL_DONE;
gf_boolean_t destroy = _gf_false;
if (!this || !data)
@@ -2796,7 +2781,6 @@ client4_0_release (call_frame_t *frame, xlator_t *this,
fdctx = this_fd_del_ctx (args->fd, this);
if (fdctx != NULL) {
remote_fd = fdctx->remote_fd;
- lk_heal_state = fdctx->lk_heal_state;
/* fdctx->remote_fd == -1 indicates a reopen attempt
in progress. Just mark ->released = 1 and let
@@ -2804,7 +2788,7 @@ client4_0_release (call_frame_t *frame, xlator_t *this,
*/
if (remote_fd == -1) {
fdctx->released = 1;
- } else if (lk_heal_state == GF_LK_HEAL_DONE) {
+ } else {
list_del_init (&fdctx->sfd_pos);
destroy = _gf_true;
}
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 955db86..74bf210 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -126,96 +126,6 @@ client_type_to_gf_type (short l_type)
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;
-
- GF_VALIDATE_OR_GOTO ("client", data, out);
-
- this = THIS;
-
- 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_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_TIMER_EXPIRED,
- "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;
- struct timespec grace_ts = {0, };
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
-
- grace_ts.tv_sec = conf->grace_timeout;
- grace_ts.tv_nsec = 0;
-
- pthread_mutex_lock (&conf->lock);
- {
- if (conf->grace_timer || !conf->grace_timer_needed) {
- gf_msg_trace (this->name, 0,
- "Client grace timer is already set "
- "or a grace-timer has already time "
- "out, not registering a new timer");
- } else {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_TIMER_REG,
- "Registering a grace timer");
-
- conf->grace_timer_needed = _gf_false;
-
- conf->grace_timer =
- gf_timer_call_after (this->ctx,
- 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 cbkfn,
@@ -2298,34 +2208,12 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
gf_msg (this->name, GF_LOG_WARNING, 0,
PC_MSG_HANDSHAKE_RETURN, "handshake "
"msg returned %d", ret);
-
- /* Cancel grace timer if set */
- pthread_mutex_lock (&conf->lock);
- {
- conf->grace_timer_needed = _gf_true;
-
- if (conf->grace_timer) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_GRACE_TIMER_CANCELLED,
- "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:
gf_msg_debug (this->name, 0, "got RPC_CLNT_DISCONNECT");
- if (!conf->lk_heal)
- client_mark_fd_bad (this);
- else
- client_register_grace_timer (this, conf);
+ client_mark_fd_bad (this);
if (!conf->skip_notify) {
if (conf->connected) {
@@ -2378,9 +2266,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
} else {
rpc->conn.config.remote_port = 0;
}
-
break;
-
case RPC_CLNT_DESTROY:
ret = client_fini_complete (this);
break;
@@ -2614,33 +2500,6 @@ out:
return ret;
}
-
-int
-client_init_grace_timer (xlator_t *this, dict_t *options,
- clnt_conf_t *conf)
-{
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, options, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
-
- GF_OPTION_RECONF ("lk-heal", conf->lk_heal, options, bool, out);
-
- gf_msg_debug (this->name, 0, "lk-heal = %s",
- (conf->lk_heal) ? "on" : "off");
-
- GF_OPTION_RECONF ("grace-timeout", conf->grace_timeout,
- options, uint32, out);
-
- gf_msg_debug (this->name, 0, "Client grace timeout value = %d",
- conf->grace_timeout);
-
- ret = 0;
-out:
- return ret;
-}
-
int
client_check_event_threads (xlator_t *this, clnt_conf_t *conf, int32_t old,
int32_t new)
@@ -2722,10 +2581,6 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("send-gids", conf->send_gids, options, bool, out);
- ret = client_init_grace_timer (this, options, conf);
- if (ret)
- goto out;
-
ret = 0;
out:
return ret;
@@ -2761,11 +2616,6 @@ init (xlator_t *this)
conf->child_up = _gf_false;
- /* Initialize parameters for lock self healing*/
- conf->lk_version = 1;
- conf->grace_timer = NULL;
- conf->grace_timer_needed = _gf_true;
-
/* Set event threads to the configured default */
GF_OPTION_INIT("event-threads", conf->event_threads, int32, out);
ret = client_check_event_threads (this, conf, STARTING_EVENT_THREADS,
@@ -2773,10 +2623,6 @@ init (xlator_t *this)
if (ret)
goto out;
- 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 */
@@ -3078,27 +2924,6 @@ struct volume_options options[] = {
{ .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.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .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.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
{ .key = {"tcp-window-size"},
.type = GF_OPTION_TYPE_SIZET,
.min = GF_MIN_SOCKET_WINDOW_SIZE,
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 003a2be..207c778 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -34,11 +34,6 @@
#define GF_MIN_SOCKET_WINDOW_SIZE (0)
typedef enum {
- GF_LK_HEAL_IN_PROGRESS,
- GF_LK_HEAL_DONE,
-} lk_heal_state_t;
-
-typedef enum {
DEFAULT_REMOTE_FD = 0,
FALLBACK_TO_ANON_FD = 1
} clnt_remote_fd_flags_t;
@@ -218,18 +213,6 @@ typedef struct clnt_conf {
char disconnect_err_logged; /* flag used to prevent
excessive disconnect
logging */
- gf_boolean_t lk_heal;
- uint16_t lk_version; /* this variable is used to distinguish
- client-server transaction while
- performing lock healing */
- uint32_t grace_timeout;
- gf_timer_t *grace_timer;
- gf_boolean_t grace_timer_needed; /* The state of this flag will
- be used to decide whether
- a new grace-timer must be
- registered or not. False
- means dont register, true
- means register */
char parent_down;
gf_boolean_t quick_reconnect; /* When reconnecting after
portmap query, do not let
@@ -266,7 +249,6 @@ typedef struct _client_fd_ctx {
int32_t flags;
fd_lk_ctx_t *lk_ctx;
pthread_mutex_t mutex;
- lk_heal_state_t lk_heal_state;
uuid_t gfid;
void (*reopen_done)(struct _client_fd_ctx*, int64_t rfd, xlator_t *);
struct list_head lock_list; /* List of all granted locks on this fd */
@@ -376,8 +358,6 @@ int clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp);
int clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp);
int client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx);
int32_t delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner);
-int client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock,
- gf_lkowner_t *owner, int32_t cmd);
int32_t delete_granted_locks_fd (clnt_fd_ctx_t *fdctx);
int32_t client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd);
void client_save_number_fds (clnt_conf_t *conf, int count);
@@ -388,14 +368,10 @@ int32_t client_dump_locks (char *name, inode_t *inode,
dict_t *dict);
int client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx);
-uint32_t client_get_lk_ver (clnt_conf_t *conf);
-
int32_t client_type_to_gf_type (short l_type);
int client_mark_fd_bad (xlator_t *this);
-int client_set_lk_version (xlator_t *this);
-
int client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t use_try_lock);
void client_default_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd,
xlator_t *this);