|
|
d84cf8 |
From e772bef5631017145cd0270d72a9ada1378e022a Mon Sep 17 00:00:00 2001
|
|
|
d84cf8 |
From: Barak Sason Rofman <bsasonro@redhat.com>
|
|
|
d84cf8 |
Date: Fri, 30 Oct 2020 08:27:47 +0200
|
|
|
d84cf8 |
Subject: [PATCH 478/478] DHT - Fixing rebalance failure on issuing stop
|
|
|
d84cf8 |
command
|
|
|
d84cf8 |
|
|
|
d84cf8 |
Issuing a stop command for an ongoing rebalance process results in an error.
|
|
|
d84cf8 |
This issue was brought up in https://bugzilla.redhat.com/1286171 and a patch
|
|
|
d84cf8 |
(https://review.gluster.org/24103/) was submitted to resolve the issue.
|
|
|
d84cf8 |
|
|
|
d84cf8 |
However the submitted patch resolved only part of the
|
|
|
d84cf8 |
problem by reducing the number of log messages that were printed (since
|
|
|
d84cf8 |
rebalnace is currently a recursive process, an error message was printed
|
|
|
d84cf8 |
for every directory) but didn't fully resolve the root cause for the
|
|
|
d84cf8 |
failure.
|
|
|
d84cf8 |
|
|
|
d84cf8 |
This patch fixes the issue by modifying the code-path which handles the
|
|
|
d84cf8 |
termination of the rebalance process by issuing a stop command.
|
|
|
d84cf8 |
|
|
|
d84cf8 |
Upstream:
|
|
|
d84cf8 |
> Reviewed-on: https://github.com/gluster/glusterfs/pull/1628
|
|
|
d84cf8 |
> fixes: #1627
|
|
|
d84cf8 |
> Change-Id: I604f2b0f8b1ccb1026b8425a14200bbd1dc5bd03
|
|
|
d84cf8 |
> Signed-off-by: Barak Sason Rofman bsasonro@redhat.com
|
|
|
d84cf8 |
|
|
|
d84cf8 |
BUG: 1286171
|
|
|
d84cf8 |
Change-Id: I604f2b0f8b1ccb1026b8425a14200bbd1dc5bd03
|
|
|
d84cf8 |
Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
|
|
|
d84cf8 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/216896
|
|
|
d84cf8 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d84cf8 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d84cf8 |
---
|
|
|
d84cf8 |
xlators/cluster/dht/src/dht-rebalance.c | 22 ++++++++++++----------
|
|
|
d84cf8 |
1 file changed, 12 insertions(+), 10 deletions(-)
|
|
|
d84cf8 |
|
|
|
d84cf8 |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
d84cf8 |
index abc10fc..d49a719 100644
|
|
|
d84cf8 |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
d84cf8 |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
d84cf8 |
@@ -3113,12 +3113,10 @@ int static gf_defrag_get_entry(xlator_t *this, int i,
|
|
|
d84cf8 |
struct dht_container *tmp_container = NULL;
|
|
|
d84cf8 |
|
|
|
d84cf8 |
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
- ret = -1;
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
if (dir_dfmeta->offset_var[i].readdir_done == 1) {
|
|
|
d84cf8 |
- ret = 0;
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
@@ -3135,7 +3133,6 @@ int static gf_defrag_get_entry(xlator_t *this, int i,
|
|
|
d84cf8 |
&(dir_dfmeta->equeue[i]), xattr_req, NULL);
|
|
|
d84cf8 |
if (ret == 0) {
|
|
|
d84cf8 |
dir_dfmeta->offset_var[i].readdir_done = 1;
|
|
|
d84cf8 |
- ret = 0;
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
@@ -3161,7 +3158,6 @@ int static gf_defrag_get_entry(xlator_t *this, int i,
|
|
|
d84cf8 |
|
|
|
d84cf8 |
while (1) {
|
|
|
d84cf8 |
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
- ret = -1;
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
@@ -3273,12 +3269,14 @@ int static gf_defrag_get_entry(xlator_t *this, int i,
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
out:
|
|
|
d84cf8 |
- if (ret == 0) {
|
|
|
d84cf8 |
- *container = tmp_container;
|
|
|
d84cf8 |
- } else {
|
|
|
d84cf8 |
- if (tmp_container) {
|
|
|
d84cf8 |
+ if (defrag->defrag_status == GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
+ if (ret == 0) {
|
|
|
d84cf8 |
+ *container = tmp_container;
|
|
|
d84cf8 |
+ } else {
|
|
|
d84cf8 |
gf_defrag_free_container(tmp_container);
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
+ } else {
|
|
|
d84cf8 |
+ gf_defrag_free_container(tmp_container);
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
return ret;
|
|
|
d84cf8 |
@@ -3487,7 +3485,7 @@ gf_defrag_process_dir(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
d84cf8 |
migrate_data, dir_dfmeta, xattr_req,
|
|
|
d84cf8 |
&should_commit_hash, perrno);
|
|
|
d84cf8 |
|
|
|
d84cf8 |
- if (defrag->defrag_status == GF_DEFRAG_STATUS_STOPPED) {
|
|
|
d84cf8 |
+ if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
@@ -3947,7 +3945,7 @@ gf_defrag_fix_layout(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
d84cf8 |
ret = gf_defrag_fix_layout(this, defrag, &entry_loc, fix_layout,
|
|
|
d84cf8 |
migrate_data);
|
|
|
d84cf8 |
|
|
|
d84cf8 |
- if (defrag->defrag_status == GF_DEFRAG_STATUS_STOPPED) {
|
|
|
d84cf8 |
+ if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
@@ -4015,6 +4013,10 @@ gf_defrag_fix_layout(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
d84cf8 |
(defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX)) {
|
|
|
d84cf8 |
ret = gf_defrag_process_dir(this, defrag, loc, migrate_data, &perrno);
|
|
|
d84cf8 |
|
|
|
d84cf8 |
+ if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
d84cf8 |
+ goto out;
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+
|
|
|
d84cf8 |
if (ret && (ret != 2)) {
|
|
|
d84cf8 |
if (perrno == ENOENT || perrno == ESTALE) {
|
|
|
d84cf8 |
ret = 0;
|
|
|
d84cf8 |
--
|
|
|
d84cf8 |
1.8.3.1
|
|
|
d84cf8 |
|