|
|
d1681e |
From 123f052f7925074087e4393b22f68b9eb510936d Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Sanju Rakonde <srakonde@redhat.com>
|
|
|
d1681e |
Date: Tue, 17 Apr 2018 18:10:01 +0530
|
|
|
d1681e |
Subject: [PATCH 284/305] glusterd: glusterd is releasing the locks before
|
|
|
d1681e |
timeout
|
|
|
d1681e |
|
|
|
d1681e |
Problem: We introduced lock timer in mgmt v3, which will realease
|
|
|
d1681e |
the lock after 3 minutes from command execution. Some commands related
|
|
|
d1681e |
to heal/profile will take more time to execute. For these comands
|
|
|
d1681e |
timeout is set to 10 minutes. As the lock timer is set to 3 minutes
|
|
|
d1681e |
glusterd is releasing the lock after 3 minutes. That means locks are
|
|
|
d1681e |
released before the command is completed its execution.
|
|
|
d1681e |
|
|
|
d1681e |
Solution: Pass a timeout parameter from cli to glusterd, when there
|
|
|
d1681e |
is a change in default timeout value(i.e, default timeout value can
|
|
|
d1681e |
be changed through command line or for the commands related to profile/heal
|
|
|
d1681e |
we will change the default timeout value to 10 minutes.) glusterd will
|
|
|
d1681e |
set the lock timer timeout according to the timeout value passed.
|
|
|
d1681e |
|
|
|
d1681e |
>Change-Id: I7b7a9a4f95ed44aca39ef9d9907f546bca99c69d
|
|
|
d1681e |
>fixes: bz#1577731
|
|
|
d1681e |
>Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
d1681e |
|
|
|
d1681e |
upstream patch: https://review.gluster.org/#/c/19890/
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I7b7a9a4f95ed44aca39ef9d9907f546bca99c69d
|
|
|
d1681e |
BUG: 1575557
|
|
|
d1681e |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/140025
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
cli/src/cli-rpc-ops.c | 22 ++++++++++++++++++++++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-handler.c | 10 ++++++++++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-locks.c | 2 ++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c | 13 +++++++++++++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-mgmt.c | 10 ++++++++++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 14 ++++++++++++++
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-syncop.c | 9 +++++++++
|
|
|
d1681e |
7 files changed, 80 insertions(+)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
index 1bb01e8..54b61ee65 100644
|
|
|
d1681e |
--- a/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
@@ -91,6 +91,9 @@ cli_to_glusterd (gf_cli_req *req, call_frame_t *frame, fop_cbk_fn_t cbkfn,
|
|
|
d1681e |
xdrproc_t xdrproc, dict_t *dict, int procnum, xlator_t *this,
|
|
|
d1681e |
rpc_clnt_prog_t *prog, struct iobref *iobref);
|
|
|
d1681e |
|
|
|
d1681e |
+int
|
|
|
d1681e |
+add_cli_cmd_timeout_to_dict (dict_t *dict);
|
|
|
d1681e |
+
|
|
|
d1681e |
rpc_clnt_prog_t cli_handshake_prog = {
|
|
|
d1681e |
.progname = "cli handshake",
|
|
|
d1681e |
.prognum = GLUSTER_HNDSK_PROGRAM,
|
|
|
d1681e |
@@ -4131,6 +4134,8 @@ cli_quotad_getlimit (call_frame_t *frame, xlator_t *this, void *data)
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
dict = data;
|
|
|
d1681e |
+ ret = add_cli_cmd_timeout_to_dict (dict);
|
|
|
d1681e |
+
|
|
|
d1681e |
ret = dict_allocate_and_serialize (dict, &req.dict.dict_val,
|
|
|
d1681e |
&req.dict.dict_len);
|
|
|
d1681e |
if (ret < 0) {
|
|
|
d1681e |
@@ -11650,6 +11655,21 @@ out:
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
+add_cli_cmd_timeout_to_dict (dict_t *dict)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ int ret = 0;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (cli_default_conn_timeout > 120) {
|
|
|
d1681e |
+ ret = dict_set_uint32 (dict, "timeout", cli_default_conn_timeout);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_log ("cli", GF_LOG_INFO, "Failed to save"
|
|
|
d1681e |
+ "timeout to dict");
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ return ret;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+int
|
|
|
d1681e |
cli_to_glusterd (gf_cli_req *req, call_frame_t *frame,
|
|
|
d1681e |
fop_cbk_fn_t cbkfn, xdrproc_t xdrproc, dict_t *dict,
|
|
|
d1681e |
int procnum, xlator_t *this, rpc_clnt_prog_t *prog,
|
|
|
d1681e |
@@ -11703,6 +11723,8 @@ cli_to_glusterd (gf_cli_req *req, call_frame_t *frame,
|
|
|
d1681e |
if (ret)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
|
|
|
d1681e |
+ ret = add_cli_cmd_timeout_to_dict (dict);
|
|
|
d1681e |
+
|
|
|
d1681e |
ret = dict_allocate_and_serialize (dict, &(req->dict).dict_val,
|
|
|
d1681e |
&(req->dict).dict_len);
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
index 962c87e..c072b05 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
d1681e |
@@ -718,6 +718,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
|
|
|
d1681e |
glusterd_op_info_t txn_op_info = {{0},};
|
|
|
d1681e |
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
|
|
|
d1681e |
uint32_t op_errno = 0;
|
|
|
d1681e |
+ uint32_t timeout = 0;
|
|
|
d1681e |
|
|
|
d1681e |
GF_ASSERT (req);
|
|
|
d1681e |
GF_ASSERT ((op > GD_OP_NONE) && (op < GD_OP_MAX));
|
|
|
d1681e |
@@ -785,6 +786,15 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+ /* Cli will add timeout key to dict if the default timeout is
|
|
|
d1681e |
+ * other than 2 minutes. Here we use this value to check whether
|
|
|
d1681e |
+ * mgmt_v3_lock_timeout should be set to default value or we
|
|
|
d1681e |
+ * need to change the value according to timeout value
|
|
|
d1681e |
+ * i.e, timeout + 120 seconds. */
|
|
|
d1681e |
+ ret = dict_get_uint32 (dict, "timeout", &timeout);
|
|
|
d1681e |
+ if (!ret)
|
|
|
d1681e |
+ priv->mgmt_v3_lock_timeout = timeout + 120;
|
|
|
d1681e |
+
|
|
|
d1681e |
ret = glusterd_mgmt_v3_lock (volname, MY_UUID, &op_errno,
|
|
|
d1681e |
"vol");
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
|
|
|
d1681e |
index a19d688..831be20 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
|
|
|
d1681e |
@@ -656,6 +656,8 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
|
|
|
d1681e |
key_dup = gf_strdup (key);
|
|
|
d1681e |
delay.tv_sec = priv->mgmt_v3_lock_timeout;
|
|
|
d1681e |
delay.tv_nsec = 0;
|
|
|
d1681e |
+ /*changing to default timeout value*/
|
|
|
d1681e |
+ priv->mgmt_v3_lock_timeout = GF_LOCK_TIMER;
|
|
|
d1681e |
|
|
|
d1681e |
ret = -1;
|
|
|
d1681e |
mgmt_lock_timer_xl = mgmt_lock_timer->xl;
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
|
|
|
d1681e |
index 5b7f0fa..993f12a 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
|
|
|
d1681e |
@@ -132,8 +132,12 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
|
|
|
d1681e |
xlator_t *this = NULL;
|
|
|
d1681e |
gf_boolean_t is_synctasked = _gf_false;
|
|
|
d1681e |
gf_boolean_t free_ctx = _gf_false;
|
|
|
d1681e |
+ glusterd_conf_t *conf = NULL;
|
|
|
d1681e |
+ uint32_t timeout = 0;
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
+ conf = this->private;
|
|
|
d1681e |
+ GF_ASSERT (conf);
|
|
|
d1681e |
GF_ASSERT (this);
|
|
|
d1681e |
GF_ASSERT (req);
|
|
|
d1681e |
|
|
|
d1681e |
@@ -183,6 +187,15 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+ /* Cli will add timeout key to dict if the default timeout is
|
|
|
d1681e |
+ * other than 2 minutes. Here we use this value to check whether
|
|
|
d1681e |
+ * mgmt_v3_lock_timeout should be set to default value or we
|
|
|
d1681e |
+ * need to change the value according to timeout value
|
|
|
d1681e |
+ * i.e, timeout + 120 seconds. */
|
|
|
d1681e |
+ ret = dict_get_uint32 (ctx->dict, "timeout", &timeout);
|
|
|
d1681e |
+ if (!ret)
|
|
|
d1681e |
+ conf->mgmt_v3_lock_timeout = timeout + 120;
|
|
|
d1681e |
+
|
|
|
d1681e |
is_synctasked = dict_get_str_boolean (ctx->dict,
|
|
|
d1681e |
"is_synctasked", _gf_false);
|
|
|
d1681e |
if (is_synctasked) {
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
d1681e |
index 8bc1f1b..d7da3c1 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
d1681e |
@@ -693,6 +693,7 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict,
|
|
|
d1681e |
uuid_t peer_uuid = {0};
|
|
|
d1681e |
xlator_t *this = NULL;
|
|
|
d1681e |
glusterd_conf_t *conf = NULL;
|
|
|
d1681e |
+ uint32_t timeout = 0;
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
GF_ASSERT (this);
|
|
|
d1681e |
@@ -703,6 +704,15 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict,
|
|
|
d1681e |
GF_ASSERT (op_errstr);
|
|
|
d1681e |
GF_ASSERT (is_acquired);
|
|
|
d1681e |
|
|
|
d1681e |
+ /* Cli will add timeout key to dict if the default timeout is
|
|
|
d1681e |
+ * other than 2 minutes. Here we use this value to check whether
|
|
|
d1681e |
+ * mgmt_v3_lock_timeout should be set to default value or we
|
|
|
d1681e |
+ * need to change the value according to timeout value
|
|
|
d1681e |
+ * i.e, timeout + 120 seconds. */
|
|
|
d1681e |
+ ret = dict_get_uint32 (dict, "timeout", &timeout);
|
|
|
d1681e |
+ if (!ret)
|
|
|
d1681e |
+ conf->mgmt_v3_lock_timeout = timeout + 120;
|
|
|
d1681e |
+
|
|
|
d1681e |
/* Trying to acquire multiple mgmt_v3 locks on local node */
|
|
|
d1681e |
ret = glusterd_multiple_mgmt_v3_lock (dict, MY_UUID, op_errno);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
index 7107a46..7e959a0 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
d1681e |
@@ -4159,11 +4159,16 @@ glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
|
|
|
d1681e |
glusterd_op_lock_ctx_t *lock_ctx = NULL;
|
|
|
d1681e |
xlator_t *this = NULL;
|
|
|
d1681e |
uint32_t op_errno = 0;
|
|
|
d1681e |
+ glusterd_conf_t *conf = NULL;
|
|
|
d1681e |
+ uint32_t timeout = 0;
|
|
|
d1681e |
|
|
|
d1681e |
GF_ASSERT (event);
|
|
|
d1681e |
GF_ASSERT (ctx);
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
+ GF_ASSERT (this);
|
|
|
d1681e |
+ conf = this->private;
|
|
|
d1681e |
+ GF_ASSERT (conf);
|
|
|
d1681e |
|
|
|
d1681e |
lock_ctx = (glusterd_op_lock_ctx_t *)ctx;
|
|
|
d1681e |
|
|
|
d1681e |
@@ -4174,6 +4179,15 @@ glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
|
|
|
d1681e |
ret = glusterd_lock (lock_ctx->uuid);
|
|
|
d1681e |
glusterd_op_lock_send_resp (lock_ctx->req, ret);
|
|
|
d1681e |
} else {
|
|
|
d1681e |
+ /* Cli will add timeout key to dict if the default timeout is
|
|
|
d1681e |
+ * other than 2 minutes. Here we use this value to check whether
|
|
|
d1681e |
+ * mgmt_v3_lock_timeout should be set to default value or we
|
|
|
d1681e |
+ * need to change the value according to timeout value
|
|
|
d1681e |
+ * i.e, timeout + 120 seconds. */
|
|
|
d1681e |
+ ret = dict_get_uint32 (lock_ctx->dict, "timeout", &timeout);
|
|
|
d1681e |
+ if (!ret)
|
|
|
d1681e |
+ conf->mgmt_v3_lock_timeout = timeout + 120;
|
|
|
d1681e |
+
|
|
|
d1681e |
ret = dict_get_str (lock_ctx->dict, "volname", &volname);
|
|
|
d1681e |
if (ret)
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
d1681e |
index 066c7f9..5aaa7f8 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
d1681e |
@@ -1818,6 +1818,7 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
|
|
|
d1681e |
glusterd_op_info_t txn_opinfo = {{0},};
|
|
|
d1681e |
uint32_t op_errno = 0;
|
|
|
d1681e |
gf_boolean_t cluster_lock = _gf_false;
|
|
|
d1681e |
+ uint32_t timeout = 0;
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
GF_ASSERT (this);
|
|
|
d1681e |
@@ -1879,6 +1880,14 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
} else {
|
|
|
d1681e |
+ /* Cli will add timeout key to dict if the default timeout is
|
|
|
d1681e |
+ * other than 2 minutes. Here we use this value to check whether
|
|
|
d1681e |
+ * mgmt_v3_lock_timeout should be set to default value or we
|
|
|
d1681e |
+ * need to change the value according to timeout value
|
|
|
d1681e |
+ * i.e, timeout + 120 seconds. */
|
|
|
d1681e |
+ ret = dict_get_uint32 (op_ctx, "timeout", &timeout);
|
|
|
d1681e |
+ if (!ret)
|
|
|
d1681e |
+ conf->mgmt_v3_lock_timeout = timeout + 120;
|
|
|
d1681e |
|
|
|
d1681e |
ret = dict_get_str (op_ctx, "globalname", &global);
|
|
|
d1681e |
if (!ret) {
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|