summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/xlator.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-10-28 04:20:14 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-28 02:56:08 -0700
commit1f4e97c01a8483e227e9e66d421302b4114decd1 (patch)
tree5b2ff1f96971cf15799c21099757044aa1f52cb5 /libglusterfs/src/xlator.c
parent6bfbcf7326a1261c8ff7cde9fd2c76a55cf756ae (diff)
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
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r--libglusterfs/src/xlator.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 6b9380f8d..44494a944 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;