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 --- cli/src/cli-rpc-ops.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index ce5236bc708..8da3fc8aa6c 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -91,6 +91,9 @@ cli_to_glusterd (gf_cli_req *req, call_frame_t *frame, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc, dict_t *dict, int procnum, xlator_t *this, rpc_clnt_prog_t *prog, struct iobref *iobref); +int +add_cli_cmd_timeout_to_dict (dict_t *dict); + rpc_clnt_prog_t cli_handshake_prog = { .progname = "cli handshake", .prognum = GLUSTER_HNDSK_PROGRAM, @@ -4088,6 +4091,8 @@ cli_quotad_getlimit (call_frame_t *frame, xlator_t *this, void *data) } dict = data; + ret = add_cli_cmd_timeout_to_dict (dict); + ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, &req.dict.dict_len); if (ret < 0) { @@ -11783,6 +11788,21 @@ out: return ret; } +int +add_cli_cmd_timeout_to_dict (dict_t *dict) +{ + int ret = 0; + + if (cli_default_conn_timeout > 120) { + ret = dict_set_uint32 (dict, "timeout", cli_default_conn_timeout); + if (ret) { + gf_log ("cli", GF_LOG_INFO, "Failed to save" + "timeout to dict"); + } + } + return ret; +} + int cli_to_glusterd (gf_cli_req *req, call_frame_t *frame, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc, dict_t *dict, @@ -11837,6 +11857,8 @@ cli_to_glusterd (gf_cli_req *req, call_frame_t *frame, if (ret) goto out; + ret = add_cli_cmd_timeout_to_dict (dict); + ret = dict_allocate_and_serialize (dict, &(req->dict).dict_val, &(req->dict).dict_len); -- cgit