From 3c3b6377d6bdea9bffec31da88dd629347617b6d Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Thu, 27 Jun 2019 19:17:29 +0530 Subject: graph/shd: Use top down approach while cleaning xlator We were cleaning xlator from botton to top, which might lead to problems when upper xlators trying to access the xlator object loaded below. One such scenario is when fd_unref happens as part of the fini call which might lead to calling the releasedir to lower xlator. This will lead to invalid mem access Backport of:https://review.gluster.org/#/c/glusterfs/+/22968/ >Change-Id: I8a6cb619256fab0b0c01a2d564fc88287c4415a0 >Updates: bz#1716695 >Signed-off-by: Mohammed Rafi KC Change-Id: I8a6cb619256fab0b0c01a2d564fc88287c4415a0 Updates: bz#1730229 Signed-off-by: Mohammed Rafi KC --- libglusterfs/src/graph.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index aea74a5edad..0b99e618191 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -1200,6 +1200,14 @@ glusterfs_graph_fini(glusterfs_graph_t *graph) if (trav->init_succeeded) { trav->cleanup_starting = 1; trav->fini(trav); + if (trav->local_pool) { + mem_pool_destroy(trav->local_pool); + trav->local_pool = NULL; + } + if (trav->itable) { + inode_table_destroy(trav->itable); + trav->itable = NULL; + } trav->init_succeeded = 0; } trav = trav->next; @@ -1401,7 +1409,7 @@ glusterfs_graph_cleanup(void *arg) pthread_mutex_lock(&ctx->cleanup_lock); { - glusterfs_graph_deactivate(graph); + glusterfs_graph_fini(graph); glusterfs_graph_destroy(graph); } pthread_mutex_unlock(&ctx->cleanup_lock); -- cgit