diff options
author | Mohit Agrawal <moagrawa@redhat.com> | 2017-05-25 21:43:42 +0530 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-05-31 20:43:53 +0000 |
commit | dba55ae364a2772904bb68a6bd0ea87289ee1470 (patch) | |
tree | e8a7cf51bd45464cd26f9c4270787ffc50228854 /xlators/features/index | |
parent | de92c363c95d16966dbcc9d8763fd4448dd84d13 (diff) |
glusterfs: Not able to mount running volume after enable brick mux and stopped any volume
Problem: After enabled brick mux if any volume has down and then try ot run mount
with running volume , mount command is hung.
Solution: After enable brick mux server has shared one data structure server_conf
for all associated subvolumes.After down any subvolume in some
ungraceful manner (remove brick directory) posix xlator sends
GF_EVENT_CHILD_DOWN event to parent xlatros and server notify
updates the child_up to false in server_conf.When client is trying
to communicate with server through mount it checks conf->child_up
and it is FALSE so it throws message "translator are not yet ready".
From this patch updated structure server_conf to save child_up status
for xlator wise. Another improtant correction from this patch is
cleanup threads from server side xlators after stop the volume.
BUG: 1453977
Change-Id: Ic54da3f01881b7c9429ce92cc569236eb1d43e0d
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://review.gluster.org/17356
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/features/index')
-rw-r--r-- | xlators/features/index/src/index.c | 22 | ||||
-rw-r--r-- | xlators/features/index/src/index.h | 1 |
2 files changed, 21 insertions, 2 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 975d5f998bd..f0462dcb7eb 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -15,6 +15,7 @@ #include "common-utils.h" #include "index-messages.h" #include <ftw.h> +#include <signal.h> #define XATTROP_SUBDIR "xattrop" #define DIRTY_SUBDIR "dirty" @@ -2264,7 +2265,6 @@ init (xlator_t *this) int ret = -1; int64_t count = -1; index_priv_t *priv = NULL; - pthread_t thread; pthread_attr_t w_attr; gf_boolean_t mutex_inited = _gf_false; gf_boolean_t cond_inited = _gf_false; @@ -2381,7 +2381,7 @@ init (xlator_t *this) count = index_fetch_link_count (this, XATTROP); index_set_link_count (priv, count, XATTROP); - ret = gf_thread_create (&thread, &w_attr, index_worker, this); + ret = gf_thread_create (&priv->thread, &w_attr, index_worker, this); if (ret) { gf_msg (this->name, GF_LOG_WARNING, ret, INDEX_MSG_WORKER_THREAD_CREATE_FAILED, @@ -2494,6 +2494,24 @@ int notify (xlator_t *this, int event, void *data, ...) { int ret = 0; + index_priv_t *priv = NULL; + + if (!this) + return 0; + + priv = this->private; + if (!priv) + return 0; + + switch (event) { + case GF_EVENT_CLEANUP: + if (priv->thread) { + (void) gf_thread_cleanup_xint (priv->thread); + priv->thread = 0; + } + break; + } + ret = default_notify (this, event, data); return ret; } diff --git a/xlators/features/index/src/index.h b/xlators/features/index/src/index.h index 5fb5a65cd8e..f622ceced5b 100644 --- a/xlators/features/index/src/index.h +++ b/xlators/features/index/src/index.h @@ -60,6 +60,7 @@ typedef struct index_priv { dict_t *pending_watchlist; dict_t *complete_watchlist; int64_t pending_count; + pthread_t thread; } index_priv_t; typedef struct index_local { |