From 1f4e97c01a8483e227e9e66d421302b4114decd1 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 28 Oct 2009 04:20:14 +0000 Subject: xlator: initialize all xlators in a loop instead of top down initialization top-down initialization will miss out on xlators from disconnected subgraphs and notify can go prematurely to these xlators Signed-off-by: Anand V. Avati BUG: 341 (mountpoint first access failure in single address space mode client/server) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=341 --- libglusterfs/src/xlator.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 6b9380f8d0f..44494a944a6 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -815,7 +815,7 @@ xlator_search_by_name (xlator_t *any, const char *name) static int32_t xlator_init_rec (xlator_t *xl) { - xlator_list_t *trav = NULL; + xlator_t *trav = NULL; int32_t ret = 0; if (xl == NULL) { @@ -823,35 +823,29 @@ xlator_init_rec (xlator_t *xl) return 0; } - trav = xl->children; - - while (trav) { - ret = 0; - ret = xlator_init_rec (trav->xlator); - if (ret != 0) - break; - gf_log (trav->xlator->name, GF_LOG_TRACE, - "Initialization done"); - trav = trav->next; - } + trav = xl; + while (trav->prev) + trav = trav->prev; - if (!ret && !xl->ready) { + while (trav) { ret = -1; - if (xl->init) { - ret = xlator_init (xl); + if (trav->init && !trav->ready) { + ret = xlator_init (trav); if (ret) { - gf_log ("xlator", GF_LOG_ERROR, + gf_log (trav->name, GF_LOG_ERROR, "Initialization of volume '%s' failed," " review your volfile again", - xl->name); + trav->name); + break; } else { - xl->init_succeeded = 1; + trav->init_succeeded = 1; } } else { - gf_log (xl->name, GF_LOG_DEBUG, "No init() found"); + gf_log (trav->name, GF_LOG_DEBUG, "No init() found"); } /* This 'xl' is checked */ - xl->ready = 1; + trav->ready = 1; + trav = trav->next; } return ret; -- cgit