summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/graph.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-09-17 16:14:41 +0530
committerAnand Avati <avati@redhat.com>2012-09-21 13:21:50 -0700
commita6234eeb2a0fb106b801a3241ce7538fd5562ff6 (patch)
tree7895498db07e65291f5657634db1bc486844b62a /libglusterfs/src/graph.c
parentaa4468cdf5acfb0087151349befa1b0d49448bd6 (diff)
libglusterfs/graph: pass correct translator pairs during reconfigure
when we autoload xlators like acl, worm or mac-compatibility, they will be loaded on top of old graph. However, corresponding ones won't be present in new graph, since newgraph doesn't contain autoloaded translators. While passing xlator pairs to reconfigure, this fact should be accounted and correct xlator pairs should be passed instead of blindly passing oldgraph->first and newgraph->first. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Change-Id: I8f4fe37b7e26dc2dcae78c1fe0d4a04f8ab84ed0 BUG: 857874 Reviewed-on: http://review.gluster.org/3949 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/graph.c')
-rw-r--r--libglusterfs/src/graph.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
index c18d026595f..70b38dc504d 100644
--- a/libglusterfs/src/graph.c
+++ b/libglusterfs/src/graph.c
@@ -20,8 +20,6 @@
#include "defaults.h"
-
-
#if 0
static void
_gf_dump_details (int argc, char **argv)
@@ -119,7 +117,8 @@ glusterfs_graph_set_first (glusterfs_graph_t *graph, xlator_t *xl)
int
glusterfs_graph_insert (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx,
- const char *type, const char *name)
+ const char *type, const char *name,
+ gf_boolean_t autoload)
{
xlator_t *ixl = NULL;
@@ -145,6 +144,8 @@ glusterfs_graph_insert (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx,
if (!ixl->name)
goto err;
+ ixl->is_autoloaded = autoload;
+
if (xlator_set_type (ixl, type) == -1) {
gf_log ("glusterfs", GF_LOG_ERROR,
"%s (%s) initialization failed",
@@ -175,7 +176,7 @@ glusterfs_graph_acl (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx)
return 0;
ret = glusterfs_graph_insert (graph, ctx, "system/posix-acl",
- "posix-acl-autoload");
+ "posix-acl-autoload", 1);
return ret;
}
@@ -191,7 +192,7 @@ glusterfs_graph_worm (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx)
return 0;
ret = glusterfs_graph_insert (graph, ctx, "features/worm",
- "worm-autoload");
+ "worm-autoload", 1);
return ret;
}
@@ -207,7 +208,7 @@ glusterfs_graph_mac_compat (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx)
return 0;
ret = glusterfs_graph_insert (graph, ctx, "features/mac-compat",
- "mac-compat-autoload");
+ "mac-compat-autoload", 1);
return ret;
}
@@ -508,18 +509,26 @@ glusterfs_graph_activate (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx)
return 0;
}
+
int
glusterfs_graph_reconfigure (glusterfs_graph_t *oldgraph,
glusterfs_graph_t *newgraph)
{
- xlator_t *old_xl = NULL;
- xlator_t *new_xl = NULL;
+ xlator_t *old_xl = NULL;
+ xlator_t *new_xl = NULL;
GF_ASSERT (oldgraph);
GF_ASSERT (newgraph);
old_xl = oldgraph->first;
+ while (old_xl->is_autoloaded) {
+ old_xl = old_xl->children->xlator;
+ }
+
new_xl = newgraph->first;
+ while (new_xl->is_autoloaded) {
+ new_xl = new_xl->children->xlator;
+ }
return xlator_tree_reconfigure (old_xl, new_xl);
}