diff options
| author | Gaurav Yadav <gyadav@redhat.com> | 2017-10-05 23:44:46 +0530 | 
|---|---|---|
| committer | Atin Mukherjee <amukherj@redhat.com> | 2017-10-17 15:44:49 +0000 | 
| commit | 614904fa7a31bf6f69074238b7e710a20e05e1bb (patch) | |
| tree | a478eddc666d9c8edae16446b50ca1b3cd9c8ffa /xlators/mgmt/glusterd/src/glusterd.c | |
| parent | 05b9dce1b503ab10efdb79a870b07d982cb5a823 (diff) | |
glusterd : introduce timer in mgmt_v3_lock
Problem:
In a multinode environment, if two of the op-sm transactions
are initiated on one of the receiver nodes at the same time,
there might be a possibility that glusterd  may end up in
stale lock.
Solution:
During mgmt_v3_lock a registration is made to  gf_timer_call_after
which release the lock after certain period of time
Change-Id: I16cc2e5186a2e8a5e35eca2468b031811e093843
BUG: 1499004
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 28 | 
1 files changed, 23 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 556423f2f7f..1c26db62fc2 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1829,14 +1829,22 @@ init (xlator_t *this)                  gf_msg (this->name, GF_LOG_INFO, 0,                          GD_MSG_DICT_SET_FAILED,                          "base-port override: %d", conf->base_port); -         } -         conf->max_port = GF_PORT_MAX; -         if (dict_get_uint32 (this->options, "max-port", -                              &conf->max_port) == 0) { +        } +        conf->max_port = GF_PORT_MAX; +        if (dict_get_uint32 (this->options, "max-port", +                             &conf->max_port) == 0) {                  gf_msg (this->name, GF_LOG_INFO, 0,                          GD_MSG_DICT_SET_FAILED,                          "max-port override: %d", conf->max_port); -         } +        } + +        conf->mgmt_v3_lock_timeout = GF_LOCK_TIMER; +        if (dict_get_uint32 (this->options, "lock-timer", +                             &conf->mgmt_v3_lock_timeout) == 0) { +                gf_msg (this->name, GF_LOG_INFO, 0, +                        GD_MSG_DICT_SET_FAILED, +                        "lock-timer override: %d", conf->mgmt_v3_lock_timeout); +        }          /* Set option to run bricks on valgrind if enabled in glusterd.vol */          this->ctx->cmd_args.valgrind = valgrind; @@ -1862,6 +1870,7 @@ init (xlator_t *this)          this->private = conf;          glusterd_mgmt_v3_lock_init (); +        glusterd_mgmt_v3_lock_timer_init();          glusterd_txn_opinfo_dict_init ();          glusterd_shdsvc_build (&conf->shd_svc); @@ -2024,6 +2033,7 @@ fini (xlator_t *this)                  gf_store_handle_destroy (conf->handle);          glusterd_sm_tr_log_delete (&conf->op_sm_log);          glusterd_mgmt_v3_lock_fini (); +        glusterd_mgmt_v3_lock_timer_fini ();          glusterd_txn_opinfo_dict_fini ();          GF_FREE (conf); @@ -2147,6 +2157,14 @@ struct volume_options options[] = {            .max = GF_PORT_MAX,            .description = "Sets the max port for portmap query"          }, +        { .key = {"mgmt-v3-lock-timeout"}, +          .type = GF_OPTION_TYPE_INT, +          .max = 600, +          .description = "Sets the mgmt-v3-lock-timeout for transactions." +                         "Specifes the default timeout value after which " +                         "lock acquired while performing transaction will " +                         "be released." +        },          { .key = {"snap-brick-path"},            .type = GF_OPTION_TYPE_STR,            .description = "directory where the bricks for the snapshots will be created"  | 
