From c54702a34aa1feb86e2f5f2b1b238966a52ae37b Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Tue, 17 Apr 2018 18:10:01 +0530 Subject: glusterd: glusterd is releasing the locks before timeout Problem: We introduced lock timer in mgmt v3, which will realease the lock after 3 minutes from command execution. Some commands related to heal/profile will take more time to execute. For these comands timeout is set to 10 minutes. As the lock timer is set to 3 minutes glusterd is releasing the lock after 3 minutes. That means locks are released before the command is completed its execution. Solution: Pass a timeout parameter from cli to glusterd, when there is a change in default timeout value(i.e, default timeout value can be changed through command line or for the commands related to profile/heal we will change the default timeout value to 10 minutes.) glusterd will set the lock timer timeout according to the timeout value passed. Change-Id: I7b7a9a4f95ed44aca39ef9d9907f546bca99c69d fixes: bz#1577731 Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-syncop.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-syncop.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index e5d4421deb4..d00a3d0f152 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -1809,6 +1809,7 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) glusterd_op_info_t txn_opinfo = {{0},}; uint32_t op_errno = 0; gf_boolean_t cluster_lock = _gf_false; + uint32_t timeout = 0; this = THIS; GF_ASSERT (this); @@ -1870,6 +1871,14 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) goto out; } } else { + /* Cli will add timeout key to dict if the default timeout is + * other than 2 minutes. Here we use this value to check whether + * mgmt_v3_lock_timeout should be set to default value or we + * need to change the value according to timeout value + * i.e, timeout + 120 seconds. */ + ret = dict_get_uint32 (op_ctx, "timeout", &timeout); + if (!ret) + conf->mgmt_v3_lock_timeout = timeout + 120; ret = dict_get_str (op_ctx, "globalname", &global); if (!ret) { -- cgit