From cb6837d03658c1005475d4040fa95504b3fd84d0 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Sun, 14 May 2017 12:34:15 +0530 Subject: 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. Change-Id: Icfd469c7407cd2d21d02e4906375ec770afeacc3 BUG: 1450630 Signed-off-by: Atin Mukherjee Reviewed-on: https://review.gluster.org/17287 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/storage/posix/src/Makefile.am | 2 +- xlators/storage/posix/src/posix-helpers.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'xlators') 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 eed63744d20..b38c3659fea 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 char *marker_xattrs[] = {"trusted.glusterfs.quota.*", @@ -1830,9 +1831,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; @@ -1907,6 +1910,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; -- cgit