From 12254aebc39933baa8186b0fb1464bfa8eab6c3d Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 9 Mar 2011 07:31:07 +0000 Subject: fuse: change the graph in 'GRAPH_NEW' event Because in the current way, we have chances of changing the graph to old one too. Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 2503 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2503 --- xlators/mount/fuse/src/fuse-bridge.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index f4e142f05..1cc9ab10a 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3320,11 +3320,25 @@ notify (xlator_t *this, int32_t event, void *data, ...) private = this->private; + graph = data; + + gf_log ("fuse", GF_LOG_DEBUG, "got event %d on graph %d", + event, ((graph) ? graph->id : 0)); + switch (event) { case GF_EVENT_GRAPH_NEW: - graph = data; - /* TODO: */ + /* We get only one GRAPH_NEW event per graph */ + if (graph) { + ret = fuse_graph_setup (this, graph); + if (ret) + gf_log (this->name, GF_LOG_WARNING, + "failed to setup the graph"); + if (!ret) + gf_log ("fuse", GF_LOG_INFO, + "got event GRAPH-NEW for graph %d", + ((graph) ? graph->id : 0)); + } break; @@ -3332,14 +3346,6 @@ notify (xlator_t *this, int32_t event, void *data, ...) case GF_EVENT_CHILD_DOWN: case GF_EVENT_CHILD_CONNECTING: { - if (data) { - graph = data; - ret = fuse_graph_setup (this, graph); - if (ret) - gf_log (this->name, GF_LOG_WARNING, - "failed to setup the graph"); - } - if (event == GF_EVENT_CHILD_UP) { pthread_mutex_lock (&private->sync_mutex); -- cgit