summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-29 04:49:53 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-29 06:18:05 -0700
commit528dde957c809014aee40737d01cb667e858e0c9 (patch)
treeb5c9a34a898822206e5698d32dcb7ecb697f95b9
parent2ce4be96bf1c3d08381cbdeb8d57800635702f37 (diff)
glusterd: make sure init is not called when there is no topology change
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c34
-rw-r--r--xlators/cluster/afr/src/afr.c2
2 files changed, 27 insertions, 9 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 96d2c6681..ac0abfac3 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -229,6 +229,11 @@ out:
return ret;
}
+/* Function has 3types of return value 0, -ve , 1
+ * return 0 =======> reconfiguration of options has succeded
+ * return 1 =======> the graph has to be reconstructed and all the xlators should be inited
+ * return -1(or -ve) =======> Some Internal Error occured during the operation
+ */
static int
glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
{
@@ -243,9 +248,10 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
if (!oldvolfile_fp)
goto out;
- if (!oldvollen)
+ if (!oldvollen) {
+ ret = 1; // Has to call INIT for the whole graph
goto out;
-
+ }
fwrite (oldvolfile, oldvollen, 1, oldvolfile_fp);
fflush (oldvolfile_fp);
@@ -264,7 +270,7 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
newvolfile_graph)) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
- "Graph topology not equal");
+ "Graph topology not equal(should call INIT)");
goto out;
}
@@ -293,8 +299,7 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
newvolfile_graph);
if (ret) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
- "Could not reconfigure new options in old "
- "graph");
+ "Could not reconfigure new options in old graph");
}
ret = 0;
@@ -352,16 +357,29 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
fwrite (rsp.spec, size, 1, tmpfp);
fflush (tmpfp);
- /* Check if only options have changed. No need to reload the
- volfile if topology hasn't changed.
+ /* Check if only options have changed. No need to reload the
+ * volfile if topology hasn't changed.
+ * glusterfs_volfile_reconfigure returns 3 possible return states
+ * return 0 =======> reconfiguration of options has succeded
+ * return 1 =======> the graph has to be reconstructed and all the xlators should be inited
+ * return -1(or -ve) =======> Some Internal Error occured during the operation
*/
+
+
ret = glusterfs_volfile_reconfigure (tmpfp);
- if (!ret) {
+ if (ret == 0) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
"No need to re-load volfile, reconfigure done");
goto out;
}
+ if (ret < 0) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG, "Reconfigure failed !!");
+ goto out;
+ }
+
+
+
ret = glusterfs_process_volfp (ctx, tmpfp);
if (ret)
goto out;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index a5906550d..09094bdbe 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -250,7 +250,7 @@ reconfigure (xlator_t *this, dict_t *options)
read_ret = dict_get_str (options, "read-subvolume", &read_subvol);
- if (read_ret == -1)
+ if (read_ret < 0)
goto next;// No need to traverse, hence set the next option
trav = this->children;