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 <avati@dev.gluster.com>

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
This commit is contained in:
Anand Avati 2009-10-28 04:20:14 +00:00 committed by Anand V. Avati
parent 6bfbcf7326
commit 1f4e97c01a

View File

@ -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;
trav = xl;
while (trav->prev)
trav = trav->prev;
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;
}
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;