From 7bf95631b52bd05b06122180f8bd4aa62c70b1a9 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Wed, 10 Oct 2018 10:31:18 +0530 Subject: core: glusterfsd keeping fd open in index xlator Problem: At the time of processing GF_EVENT_PARENT_DOWN at brick xlator, it forwards the event to next xlator only while xlator ensures no stub is in progress. At io-thread xlator it decreases stub_cnt before the process a stub and notify EVENT to next xlator Solution: Introduce a new counter to save stub_cnt and decrease the counter after process the stub completely at io-thread xlator. To avoid brick crash at the time of call xlator_mem_cleanup move only brick xlator if detach brick name has found in the graph Note: Thanks to pranith for sharing a simple reproducer to reproduce the same fixes bz#1637934 Change-Id: I1a694a001f7a5417e8771e3adf92c518969b6baa Signed-off-by: Mohit Agrawal --- libglusterfs/src/xlator.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 01cb27896ee..b305ad50e5d 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -1051,6 +1051,7 @@ xlator_mem_cleanup(xlator_t *this) top = ctx->active->first; LOCK(&ctx->volfile_lock); /* TODO here we have leak for xlator node in a graph */ + /* Need to move only top xlator from a graph */ for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) { victim = (*trav_p)->xlator; if (victim->call_cleanup && !strcmp(victim->name, this->name)) { @@ -1058,19 +1059,6 @@ xlator_mem_cleanup(xlator_t *this) break; } } - /* TODO Sometime brick xlator is not moved from graph so followed below - approach to move brick xlator from a graph, will move specific brick - xlator from graph only while inode table and mem_acct are cleaned up - */ - trav_p = &top->children; - while (*trav_p) { - victim = (*trav_p)->xlator; - if (victim->call_cleanup && !victim->itable && !victim->mem_acct) { - (*trav_p) = (*trav_p)->next; - } else { - trav_p = &(*trav_p)->next; - } - } UNLOCK(&ctx->volfile_lock); } } -- cgit