From e2766c32631d27519e688ebec48c408b36e3cc79 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 27 Feb 2018 15:58:56 +0530 Subject: 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 This patch is required to forward port io-threads namespace patch. Updates: #401 Change-Id: Ice477fdf4b8934f9fac0b4a2f6c93db97429a586 Signed-off-by: Varsha Rao --- xlators/performance/io-threads/src/io-threads.c | 24 +++++++++++++++++++++++- xlators/performance/io-threads/src/io-threads.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'xlators/performance/io-threads') 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; -- cgit