diff options
-rw-r--r-- | libglusterfs/src/call-stub.h | 1 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 41 |
2 files changed, 39 insertions, 3 deletions
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 5779ee36e58..67a5a650ca5 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -22,6 +22,7 @@ typedef struct _call_stub { char wind; call_frame_t *frame; glusterfs_fop_t fop; + gf_boolean_t poison; struct mem_pool *stub_mem_pool; /* pointer to stub mempool in ctx_t */ uint32_t jnl_meta_len; uint32_t jnl_data_len; diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 97d2dea1b71..09ae02bf2ac 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -220,8 +220,15 @@ iot_worker (void *data) } pthread_mutex_unlock (&conf->mutex); - if (stub) /* guard against spurious wakeups */ - call_resume (stub); + if (stub) { /* guard against spurious wakeups */ + if (stub->poison) { + gf_log (this->name, GF_LOG_INFO, + "Dropping poisoned request %p.", stub); + call_stub_destroy (stub); + } else { + call_resume (stub); + } + } stub = NULL; if (bye) @@ -1306,6 +1313,32 @@ fini (xlator_t *this) return; } +static int +iot_disconnect_cbk (xlator_t *this, client_t *client) +{ + int i; + call_stub_t *curr; + call_stub_t *next; + iot_conf_t *conf = this->private; + + pthread_mutex_lock (&conf->mutex); + for (i = 0; i < IOT_PRI_MAX; i++) { + list_for_each_entry_safe (curr, next, &conf->reqs[i], list) { + if (curr->frame->root->client != client) { + continue; + } + gf_log (this->name, GF_LOG_INFO, + "poisoning %s fop at %p for client %s", + gf_fop_list[curr->fop], curr, + client->client_uid); + curr->poison = _gf_true; + } + } + pthread_mutex_unlock (&conf->mutex); + + return 0; +} + struct xlator_dumpops dumpops = { .priv = iot_priv_dump, }; @@ -1357,7 +1390,9 @@ struct xlator_fops fops = { .zerofill = iot_zerofill, }; -struct xlator_cbks cbks; +struct xlator_cbks cbks = { + .client_disconnect = iot_disconnect_cbk, +}; struct volume_options options[] = { { .key = {"thread-count"}, |