cluster/tier: Disallow detach commit when detach in progress
authorDan Lambright <dlambrig@redhat.com>
Thu, 1 Oct 2015 15:05:25 +0000 (11:05 -0400)
committerDan Lambright <dlambrig@redhat.com>
Mon, 16 Nov 2015 12:10:02 +0000 (04:10 -0800)
1. Check if detach is running, disallow detach commit if so.
2. Cleanup shutdown of tier daemon on detach: do not rerun fix-layout,
   do not send incorrect status back to glusterd.

Change-Id: I97202f748773c1176396a4ffd32a4c7fa9b9c1bc
BUG: 1279637
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/12560
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
xlators/cluster/dht/src/dht-rebalance.c
xlators/cluster/dht/src/tier.c
xlators/mgmt/glusterd/src/glusterd-brick-ops.c

index 11164b6586a47d00544b6ba04ab5378acbcd5bb1..7e9ba11fb2663304bf235488e77a05b17872b399 100644 (file)
@@ -3374,9 +3374,6 @@ gf_defrag_start_crawl (void *data)
                         if (ret)
                                 goto out;
 
-                        ret = gf_defrag_fix_layout (this, defrag, &loc,
-                                                    fix_layout,
-                                                    migrate_data);
                 }
         }
         gf_log ("DHT", GF_LOG_INFO, "crawling file-system completed");
index b37c8edfdd5072a27d7a348cb3dce8bf8d9fd7b9..e857dace0381f5e23006469bcd578b244530d10a 100644 (file)
@@ -1372,10 +1372,11 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
                 if (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) {
                         ret = 0;
                         defrag->defrag_status =
-                                        GF_DEFRAG_STATUS_COMPLETE;
-                        gf_msg_debug (this->name, 0,
-                                      "defrag->defrag_cmd == "
-                                      "GF_DEFRAG_CMD_START_DETACH_TIER");
+                                GF_DEFRAG_STATUS_COMPLETE;
+                        gf_msg (this->name, GF_LOG_DEBUG, 0,
+                                DHT_MSG_LOG_TIER_ERROR,
+                                "defrag->defrag_cmd == "
+                                "GF_DEFRAG_CMD_START_DETACH_TIER");
                         goto out;
                 }
 
index efd70581f464713026807d641f370e8f17bd3962..67119a9b53b3bf1242dc2956dc67f335df86bc43 100644 (file)
@@ -2046,6 +2046,31 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
                                 GD_MSG_VOL_NOT_TIER, "%s", errstr);
                         goto out;
                 }
+                ret = glusterd_remove_brick_validate_bricks (cmd, brick_count,
+                                                             dict, volinfo,
+                                                             &errstr);
+                if (ret)
+                        goto out;
+
+                /* If geo-rep is configured, for this volume, it should be
+                 * stopped.
+                 */
+                param.volinfo = volinfo;
+                ret = glusterd_check_geo_rep_running (&param, op_errstr);
+                if (ret || param.is_active) {
+                        ret = -1;
+                        goto out;
+                }
+
+                if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_STARTED) {
+                        ret = -1;
+                        errstr = gf_strdup("Detach is in progress. Please "
+                                           "retry after completion");
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                GD_MSG_OIP_RETRY_LATER, "%s", errstr);
+                        goto out;
+                }
+                break;
 
         case GF_OP_CMD_COMMIT:
                 if (volinfo->decommission_in_progress) {