diff options
-rw-r--r-- | libglusterfs/src/fd-lk.c | 2 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 21 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 7 |
3 files changed, 21 insertions, 9 deletions
diff --git a/libglusterfs/src/fd-lk.c b/libglusterfs/src/fd-lk.c index 4e10d649ee9..32f3e0ad063 100644 --- a/libglusterfs/src/fd-lk.c +++ b/libglusterfs/src/fd-lk.c @@ -425,7 +425,7 @@ print_lock_list (fd_lk_ctx_t *lk_ctx) { fd_lk_ctx_node_t *lk = NULL; - gf_log ("fd-lk", GF_LOG_WARNING, "lock list:"); + gf_log ("fd-lk", GF_LOG_DEBUG, "lock list:"); list_for_each_entry (lk, &lk_ctx->lk_list, next) gf_log ("fd-lk", GF_LOG_DEBUG, "owner = %s, " diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index b954906c1ce..3567dedbd1b 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1985,13 +1985,16 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, /* Cancel grace timer if set */ pthread_mutex_lock (&conf->lock); { + conf->grace_timer_flag = _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; + + conf->grace_timer = NULL; } } pthread_mutex_unlock (&conf->lock); @@ -2003,12 +2006,16 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, pthread_mutex_lock (&conf->lock); { - if (conf->grace_timer) { - gf_log (this->name, GF_LOG_DEBUG, - "Client grace timer is already set"); + if (conf->grace_timer || !conf->grace_timer_flag) { + gf_log (this->name, GF_LOG_TRACE, + "Client grace timer is already set " + "or a grace-timer has already timeout, " + "not registering a new timer"); } else { gf_log (this->name, GF_LOG_WARNING, "Registering a grace timer"); + conf->grace_timer_flag = _gf_false; + conf->grace_timer = gf_timer_call_after (this->ctx, conf->grace_tv, @@ -2322,7 +2329,6 @@ 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 " @@ -2343,8 +2349,9 @@ init (xlator_t *this) INIT_LIST_HEAD (&conf->saved_fds); /* Initialize parameters for lock self healing*/ - conf->lk_version = 1; - conf->grace_timer = NULL; + conf->lk_version = 1; + conf->grace_timer = NULL; + conf->grace_timer_flag = _gf_true; ret = client_init_grace_timer (this, this->options, conf); if (ret) diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 1f8f75cece5..7203556f58e 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -100,7 +100,12 @@ typedef struct clnt_conf { performing lock healing */ struct timeval grace_tv; gf_timer_t *grace_timer; - + gf_boolean_t grace_timer_flag; /* 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; } clnt_conf_t; |