Patchwork [BUG:2084] mgmt/glusterd: fixes for uninterrupted replace-brick with nfs

login
register
Submitter Vijay Bellur
Date 2010-11-14 17:38:23
Message ID <20101114173823.GA15688@dev.gluster.com>
Download mbox | patch
Permalink /patch/5691/
State Accepted
Headers show

Comments

Vijay Bellur - 2010-11-14 17:38:23
Signed-off-by: Vijay Bellur <vijay@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |   34 +++++++++++++++++++++------
 1 files changed, 26 insertions(+), 8 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 62dd7fa..4671aa8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2045,11 +2045,18 @@  rb_src_brick_restart (glusterd_volinfo_t *volinfo,
                       glusterd_brickinfo_t *src_brickinfo,
                       int activate_pump)
 {
-        int ret = 0;
+        int                     ret = 0;
 
         gf_log ("", GF_LOG_DEBUG,
                 "Attempting to kill src");
 
+        ret = glusterd_nfs_server_stop ();
+
+        if (ret) {
+                gf_log ("", GF_LOG_ERROR, "Unable to stop nfs, ret: %d",
+                        ret);
+        }
+
         ret = glusterd_volume_stop_glusterfs (volinfo, src_brickinfo);
         if (ret) {
                 gf_log ("", GF_LOG_ERROR, "Unable to stop "
@@ -2084,8 +2091,12 @@  rb_src_brick_restart (glusterd_volinfo_t *volinfo,
                 goto out;
         }
 
-
 out:
+        ret = glusterd_nfs_server_start ();
+        if (ret) {
+                gf_log ("", GF_LOG_ERROR, "Unable to start nfs, ret: %d",
+                        ret);
+        }
         return ret;
 }
 
@@ -3055,12 +3066,6 @@  glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict)
                         "Received commit - will be adding dst brick and "
                         "removing src brick");
 
-		ret = glusterd_check_generate_start_nfs (volinfo);
-		if (ret) {
-			gf_log ("", GF_LOG_CRITICAL, "Failed to generate "
-				" nfs volume file");
-		}
-
                 if (!glusterd_is_local_addr (dst_brickinfo->hostname) &&
                     replace_op != GF_REPLACE_OP_COMMIT_FORCE) {
                         gf_log ("", GF_LOG_NORMAL,
@@ -3080,18 +3085,31 @@  glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict)
                 }
 
 
+                ret = glusterd_nfs_server_stop ();
+                if (ret) {
+                        gf_log ("", GF_LOG_ERROR, "Unable to stop nfs"
+                                                  "server, ret: %d", ret);
+                }
+
 		ret = glusterd_op_perform_replace_brick (volinfo, src_brick,
 							 dst_brick);
 		if (ret) {
 			gf_log ("", GF_LOG_CRITICAL, "Unable to add "
 				"dst-brick: %s to volume: %s",
 				dst_brick, volinfo->volname);
+		        (void) glusterd_check_generate_start_nfs (volinfo);
 			goto out;
 		}
 
 		volinfo->version++;
 		volinfo->defrag_status = 0;
 
+		ret = glusterd_check_generate_start_nfs (volinfo);
+		if (ret) {
+			gf_log ("", GF_LOG_CRITICAL, "Failed to generate "
+				" nfs volume file");
+		}
+
 		ret = glusterd_store_update_volume (volinfo);
 
 		if (ret)