diff options
author | Varsha Rao <varao@redhat.com> | 2018-02-26 12:55:06 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-02-27 03:45:30 +0000 |
commit | 430bff7dc330eec9447423e95f2cae49744a79c3 (patch) | |
tree | edfa5b8771911bfd030f504eb82d5ab7a677e988 | |
parent | 8e21ea3e4f66c27fca796b51f77e4a0231211ff4 (diff) | |
download | glusterfs-430bff7dc330eec9447423e95f2cae49744a79c3.tar.gz glusterfs-430bff7dc330eec9447423e95f2cae49744a79c3.tar.xz glusterfs-430bff7dc330eec9447423e95f2cae49744a79c3.zip |
performance/io-threads: nuke everything from a client when it disconnects
> io-threads: nuke everything from a client when it disconnects
> Commit ID: 4d8268d760
> https://review.gluster.org/#/c/18254/
> By Jeff Darcy <jdarcy@fb.com>
This patch is required to forward port io-threads namespace patch.
Updates: #401
Change-Id: I13d3a74862eea3d01e8dbc8736987c3dae6e8b2a
Signed-off-by: Varsha Rao <varao@redhat.com>
-rw-r--r-- | libglusterfs/src/call-stub.h | 9 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 39 |
2 files changed, 42 insertions, 6 deletions
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index e20f6a5a09..c3b63d4c75 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -18,10 +18,11 @@ #include "list.h" typedef struct _call_stub { - struct list_head list; - char wind; - call_frame_t *frame; - glusterfs_fop_t fop; + struct list_head list; + 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 601e04abad..7b4b316c4b 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -222,8 +222,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) @@ -1322,6 +1329,33 @@ iot_client_destroy (xlator_t *this, client_t *client) GF_FREE (tmp); } + return 0; +} + +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; + iot_client_ctx_t *ctx; + + pthread_mutex_lock (&conf->mutex); + for (i = 0; i < GF_FOP_PRI_MAX; i++) { + ctx = &conf->no_client[i]; + list_for_each_entry_safe (curr, next, &ctx->reqs, 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; } @@ -1383,6 +1417,7 @@ struct xlator_fops fops = { struct xlator_cbks cbks = { .client_destroy = iot_client_destroy, + .client_disconnect = iot_disconnect_cbk, }; struct volume_options options[] = { |