summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-05-14 12:34:15 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-06-06 13:01:29 +0000
commit8f79df30c034b303ca86aa4233fd8e899f1da888 (patch)
treed9e70391b775bd9e8712bf9106ba2c25445dafc9
parent5d49ff1f8b41f5babb2f6d484b3f1e1e6bb51ec8 (diff)
brick mux: Detach brick on posix health check failure
With brick mux enabled, we'd need to detach a particular brick if the underlying backend has gone bad. This patch addresses the same. >Reviewed-on: https://review.gluster.org/17287 >Smoke: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> >(cherry picked from commit cb6837d03658c1005475d4040fa95504b3fd84d0) Change-Id: Icfd469c7407cd2d21d02e4906375ec770afeacc3 BUG: 1458570 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17459 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
-rw-r--r--configure.ac4
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c2
-rw-r--r--glusterfsd/src/glusterfsd.h2
-rw-r--r--xlators/storage/posix/src/Makefile.am2
-rw-r--r--xlators/storage/posix/src/posix-helpers.c25
5 files changed, 28 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 7d5728f6445..43efd6d087a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,10 +284,10 @@ AC_ARG_ENABLE([debug],
[Enable debug build options.]))
if test "x$enable_debug" = "xyes"; then
BUILD_DEBUG=yes
- CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
+ CFLAGS="${CFLAGS} -g -rdynamic -O0 -DDEBUG"
else
BUILD_DEBUG=no
- CFLAGS="${CFLAGS} -g"
+ CFLAGS="${CFLAGS} -g -rdynamic"
fi
AC_ARG_ENABLE([privport_tracking],
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 30ffa2ae81b..8ede110121b 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -184,7 +184,7 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret)
return ret;
}
-static void
+void
glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr)
{
struct event_pool *pool = ctx->event_pool;
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index 6a30ee9e3f7..bc3f2605466 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -120,6 +120,8 @@ int glusterfs_volume_top_write_perf (uint32_t blk_size, uint32_t blk_count,
int glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count,
char *brick_path, double *throughput,
double *time);
+void
+glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr);
extern glusterfs_ctx_t *glusterfsd_ctx;
#endif /* __GLUSTERFSD_H__ */
diff --git a/xlators/storage/posix/src/Makefile.am b/xlators/storage/posix/src/Makefile.am
index 47e64b0eac3..2245098c9e4 100644
--- a/xlators/storage/posix/src/Makefile.am
+++ b/xlators/storage/posix/src/Makefile.am
@@ -15,7 +15,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
-I$(top_srcdir)/rpc/xdr/src -I$(top_builddir)/rpc/xdr/src \
-I$(top_srcdir)/rpc/rpc-lib/src
-AM_CFLAGS = -fno-strict-aliasing -Wall $(GF_CFLAGS)
+AM_CFLAGS = -fno-strict-aliasing -Wall $(GF_CFLAGS) -I$(top_srcdir)/glusterfsd/src
CLEANFILES =
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index d39a77bbe06..cf03035c4b2 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -51,6 +51,7 @@
#include "hashfn.h"
#include "glusterfs-acl.h"
#include "events.h"
+#include "glusterfsd.h"
#include <sys/types.h>
char *marker_xattrs[] = {"trusted.glusterfs.quota.*",
@@ -1850,9 +1851,11 @@ posix_health_check_thread_proc (void *data)
struct posix_private *priv = NULL;
uint32_t interval = 0;
int ret = -1;
- xlator_t *top = NULL;
- xlator_list_t **trav_p = NULL;
- int count = 0;
+ xlator_t *top = NULL;
+ xlator_t *victim = NULL;
+ xlator_list_t **trav_p = NULL;
+ int count = 0;
+ gf_boolean_t victim_found = _gf_false;
this = data;
priv = this->private;
@@ -1927,6 +1930,22 @@ abort:
if (ret == 0)
kill (getpid(), SIGKILL);
+ } else {
+ for (trav_p = &top->children; *trav_p;
+ trav_p = &(*trav_p)->next) {
+ victim = (*trav_p)->xlator;
+ if (victim &&
+ strcmp (victim->name, priv->base_path) == 0) {
+ victim_found = _gf_true;
+ break;
+ }
+ }
+ if (victim_found) {
+ top->notify (top, GF_EVENT_TRANSPORT_CLEANUP, victim);
+ glusterfs_mgmt_pmap_signout (glusterfsd_ctx,
+ priv->base_path);
+ glusterfs_autoscale_threads (THIS->ctx, -1);
+ }
}
return NULL;