From 5bc4594dabc08fd4de1940c044946e33037f2ac7 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Tue, 2 Oct 2018 08:54:28 +0530 Subject: core: glusterfsd keeping fd open in index xlator Problem: Current resource cleanup sequence is not perfect while brick mux is enabled Solution: 1) Destroying xprt after cleanup all fd associated with a client 2) Before call fini for brick xlators ensure no stub should be running on a brick Change-Id: I86195785e428f57d3ef0da3e4061021fafacd435 fixes: bz#1631357 Signed-off-by: Mohit Agrawal --- libglusterfs/src/defaults-tmpl.c | 7 ++++++- libglusterfs/src/xlator.c | 2 ++ libglusterfs/src/xlator.h | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/defaults-tmpl.c b/libglusterfs/src/defaults-tmpl.c index 2ce5ec7c685..bdb30d4872c 100644 --- a/libglusterfs/src/defaults-tmpl.c +++ b/libglusterfs/src/defaults-tmpl.c @@ -124,13 +124,18 @@ int default_notify(xlator_t *this, int32_t event, void *data, ...) { GF_UNUSED int ret = 0; + xlator_t *victim = data; + switch (event) { case GF_EVENT_PARENT_UP: case GF_EVENT_PARENT_DOWN: { xlator_list_t *list = this->children; while (list) { - xlator_notify(list->xlator, event, this); + if (victim && victim->cleanup_starting) + xlator_notify(list->xlator, event, victim); + else + xlator_notify(list->xlator, event, this); list = list->next; } } break; diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 6975fbbd15f..01cb27896ee 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -700,6 +700,8 @@ xlator_init(xlator_t *xl) xl->mem_acct_init(xl); xl->instance_name = NULL; + GF_ATOMIC_INIT(xl->xprtrefcnt, 0); + GF_ATOMIC_INIT(xl->fd_cnt, 0); if (!xl->init) { gf_msg(xl->name, GF_LOG_WARNING, 0, LG_MSG_INIT_FAILED, "No init() found"); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 12078bb72e3..9bdbd7f0e26 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -842,6 +842,15 @@ struct _xlator { /* Flag to understand how this xlator is categorized */ gf_category_t category; + + /* Variable to save fd_count for detach brick */ + gf_atomic_t fd_cnt; + + /* Variable to save xprt associated for detach brick */ + gf_atomic_t xprtrefcnt; + + /* Flag to notify got CHILD_DOWN event for detach brick */ + uint32_t notify_down; }; typedef struct { -- cgit