summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarsha Rao <varao@redhat.com>2018-02-27 15:58:56 +0530
committerAmar Tumballi <amarts@redhat.com>2018-02-28 01:45:51 +0000
commite2766c32631d27519e688ebec48c408b36e3cc79 (patch)
tree1eb4acb013cec0b3766bc567a7b4c861980b8d97
parent07372c3729578cd8580209eac3ea7a981efeba3e (diff)
perfomance/io-threads: Add option to disable client disconnect feature
> Add options to disable new features > Commit ID: c071992e8d > https://review.gluster.org/#/c/18291/ > By Michael Goulet <mgoulet@fb.com> This patch is required to forward port io-threads namespace patch. Updates: #401 Change-Id: Ice477fdf4b8934f9fac0b4a2f6c93db97429a586 Signed-off-by: Varsha Rao <varao@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c5
-rw-r--r--xlators/performance/io-threads/src/io-threads.c24
-rw-r--r--xlators/performance/io-threads/src/io-threads.h1
3 files changed, 29 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 837c5bc9cd8..1c448809641 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1757,6 +1757,11 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "watchdog-secs",
.op_version = GD_OP_VERSION_4_1_0
},
+ { .key = "performance.iot-cleanup-disconnected-reqs",
+ .voltype = "performance/io-threads",
+ .option = "cleanup-disconnected-reqs",
+ .op_version = GD_OP_VERSION_4_1_0
+ },
/* Other perf xlators' options */
{ .key = "performance.cache-size",
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index fd03296f46f..7bdcc624659 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -1154,8 +1154,12 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("enable-least-priority", conf->least_priority,
options, bool, out);
+ GF_OPTION_RECONF ("cleanup-disconnected-reqs",
+ conf->cleanup_disconnected_reqs, options, bool, out);
+
GF_OPTION_RECONF ("watchdog-secs", conf->watchdog_secs, options,
int32, out);
+
if (conf->watchdog_secs > 0) {
start_iot_watchdog (this);
} else {
@@ -1232,9 +1236,13 @@ init (xlator_t *this)
conf->ac_iot_limit[GF_FOP_PRI_LEAST], int32, out);
GF_OPTION_INIT ("idle-time", conf->idle_time, int32, out);
+
GF_OPTION_INIT ("enable-least-priority", conf->least_priority,
bool, out);
+ GF_OPTION_INIT ("cleanup-disconnected-reqs",
+ conf->cleanup_disconnected_reqs, bool, out);
+
conf->this = this;
for (i = 0; i < GF_FOP_PRI_MAX; i++) {
@@ -1341,6 +1349,10 @@ iot_disconnect_cbk (xlator_t *this, client_t *client)
iot_conf_t *conf = this->private;
iot_client_ctx_t *ctx;
+ if (!conf || !conf->cleanup_disconnected_reqs) {
+ goto out;
+ }
+
pthread_mutex_lock (&conf->mutex);
for (i = 0; i < GF_FOP_PRI_MAX; i++) {
ctx = &conf->no_client[i];
@@ -1356,6 +1368,8 @@ iot_disconnect_cbk (xlator_t *this, client_t *client)
}
}
pthread_mutex_unlock (&conf->mutex);
+
+out:
return 0;
}
@@ -1505,6 +1519,14 @@ struct volume_options options[] = {
.description = "Number of seconds a queue must be stalled before "
"starting an 'emergency' thread."
},
- { .key = {NULL},
+ { .key = {"cleanup-disconnected-reqs"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .op_version = {GD_OP_VERSION_4_1_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_CLIENT_OPT,
+ .tags = {"io-threads"},
+ .description = "'Poison' queued requests when a client disconnects"
+ },
+ { .key = {NULL},
},
};
diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h
index 8e16ada55a0..7124169b795 100644
--- a/xlators/performance/io-threads/src/io-threads.h
+++ b/xlators/performance/io-threads/src/io-threads.h
@@ -79,6 +79,7 @@ struct iot_conf {
gf_boolean_t watchdog_running;
pthread_t watchdog_thread;
gf_boolean_t queue_marked[GF_FOP_PRI_MAX];
+ gf_boolean_t cleanup_disconnected_reqs;
};
typedef struct iot_conf iot_conf_t;