summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-09-30 11:41:07 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-30 11:19:28 -0700
commitda74288339563759f568aa5052fdce4c45ebcd22 (patch)
tree49c2f9eaa7131c45b864b7c073fb2d20615a9881
parentaf18c636c44b1ea56296850e55afe0e4b2ce845c (diff)
glusterfsd: perform init new graph if re-configure fails
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1235 (Bug for all pump/migrate commits) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1235
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c10
-rw-r--r--libglusterfs/src/xlator.c16
-rw-r--r--xlators/protocol/client/src/client.c35
3 files changed, 43 insertions, 18 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index ac0abfac35e..b1fa5ca47e4 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -229,7 +229,7 @@ out:
return ret;
}
-/* Function has 3types of return value 0, -ve , 1
+/* 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
@@ -249,7 +249,7 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
goto out;
if (!oldvollen) {
- ret = 1; // Has to call INIT for the whole graph
+ ret = 1; // Has to call INIT for the whole graph
goto out;
}
fwrite (oldvolfile, oldvollen, 1, oldvolfile_fp);
@@ -300,6 +300,7 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
if (ret) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
"Could not reconfigure new options in old graph");
+ goto out;
}
ret = 0;
@@ -359,13 +360,12 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
/* 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
+ * 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 == 0) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
@@ -378,8 +378,6 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
-
-
ret = glusterfs_process_volfp (ctx, tmpfp);
if (ret)
goto out;
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index a09dd2e1eb0..105ee497b17 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -921,6 +921,7 @@ xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)
{
xlator_list_t *trav1 = NULL;
xlator_list_t *trav2 = NULL;
+ int32_t ret = 0;
if (old_xl == NULL || new_xl == NULL) {
gf_log ("xlator", GF_LOG_DEBUG, "invalid argument");
@@ -931,7 +932,10 @@ xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)
trav2 = new_xl->children;
while (trav1 && trav2) {
- xlator_reconfigure_rec (trav1->xlator, trav2->xlator);
+ ret = xlator_reconfigure_rec (trav1->xlator, trav2->xlator);
+
+ if (ret)
+ goto out;
gf_log (trav1->xlator->name, GF_LOG_DEBUG, "reconfigured");
@@ -939,12 +943,16 @@ xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)
trav2 = trav2->next;
}
- if (old_xl->reconfigure)
- old_xl->reconfigure (old_xl, new_xl->options);
+ if (old_xl->reconfigure) {
+ ret = old_xl->reconfigure (old_xl, new_xl->options);
+ if (ret)
+ goto out;
+ }
else
gf_log (old_xl->name, GF_LOG_DEBUG, "No reconfigure() found");
- return 0;
+out:
+ return ret;
}
int
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index b703b88f4b7..84f3778393f 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1769,14 +1769,18 @@ int
reconfigure (xlator_t *this, dict_t *options)
{
int ret = 0;
- int timeout_ret=0;
- int ping_timeout;
- int frame_timeout;
+ int timeout_ret = 0;
+ int ping_timeout = 0;
+ int frame_timeout = 0;
clnt_conf_t *conf = NULL;
+ char *old_remote_subvol = NULL;
+ char *new_remote_subvol = NULL;
+ int subvol_ret = 0;
+
+
-
conf = this->private;
-
+
timeout_ret = dict_get_int32 (options, "frame-timeout",
&frame_timeout);
if (timeout_ret == 0) {
@@ -1798,7 +1802,7 @@ reconfigure (xlator_t *this, dict_t *options)
goto out;
}
-
+
gf_log (this->name, GF_LOG_DEBUG,
"Reconfiguring otion frame-timeout to %d",
frame_timeout);
@@ -1827,15 +1831,30 @@ reconfigure (xlator_t *this, dict_t *options)
ret = -1;
goto out;
}
-
+
gf_log (this->name, GF_LOG_DEBUG, "Reconfiguring "
"'option ping-timeout' to %d", ping_timeout);
conf->opt.ping_timeout = ping_timeout;
}
+ subvol_ret = dict_get_str (this->options, "remote-subvolume",
+ &old_remote_subvol);
+
+ if (subvol_ret == 0) {
+
+ subvol_ret = dict_get_str (options, "remote-subvolume",
+ &new_remote_subvol);
+
+ if (subvol_ret == 0) {
+ if (strcmp (old_remote_subvol, new_remote_subvol)) {
+ ret = 1;
+ goto out;
+ }
+ }
+ }
+
out:
return ret;
-
}