|
|
3604df |
From e172864304da1aad7776ad4b246fb039a5b7d4c0 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Susant Palai <spalai@redhat.com>
|
|
|
3604df |
Date: Thu, 5 Jan 2017 11:46:20 +0530
|
|
|
3604df |
Subject: [PATCH 267/267] dht/rebalance: remove errno check for failure
|
|
|
3604df |
detection
|
|
|
3604df |
|
|
|
3604df |
Backport of upstream patch: http://review.gluster.org/#/c/16328/
|
|
|
3604df |
|
|
|
3604df |
BUG: 1405000
|
|
|
3604df |
Change-Id: I867419ca36a81ef7209e6911a46c1c2c898b8eab
|
|
|
3604df |
Reviewed-on: http://review.gluster.org/16328
|
|
|
3604df |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
3604df |
Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/94359
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
xlators/cluster/dht/src/dht-rebalance.c | 29 +++++++++++++----------------
|
|
|
3604df |
1 file changed, 13 insertions(+), 16 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
3604df |
index ed9991f..39a7bb6 100644
|
|
|
3604df |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
3604df |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
3604df |
@@ -2435,7 +2435,7 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container,
|
|
|
3604df |
loc_t *loc, dht_conf_t *conf, gf_defrag_info_t *defrag,
|
|
|
3604df |
fd_t *fd, dict_t *migrate_data,
|
|
|
3604df |
struct dir_dfmeta *dir_dfmeta, dict_t *xattr_req,
|
|
|
3604df |
- int *should_commit_hash)
|
|
|
3604df |
+ int *should_commit_hash, int *perrno)
|
|
|
3604df |
{
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
char is_linkfile = 0;
|
|
|
3604df |
@@ -2446,7 +2446,6 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container,
|
|
|
3604df |
struct dht_container *tmp_container = NULL;
|
|
|
3604df |
xlator_t *hashed_subvol = NULL;
|
|
|
3604df |
xlator_t *cached_subvol = NULL;
|
|
|
3604df |
- int fop_errno = 0;
|
|
|
3604df |
|
|
|
3604df |
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
@@ -2474,7 +2473,7 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container,
|
|
|
3604df |
DHT_MSG_MIGRATE_DATA_FAILED,
|
|
|
3604df |
"Readdirp failed. Aborting data migration for "
|
|
|
3604df |
"directory: %s", loc->path);
|
|
|
3604df |
- fop_errno = -ret;
|
|
|
3604df |
+ *perrno = -ret;
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
@@ -2731,13 +2730,12 @@ out:
|
|
|
3604df |
dict_unref (xattr_rsp);
|
|
|
3604df |
|
|
|
3604df |
|
|
|
3604df |
- errno = fop_errno;
|
|
|
3604df |
return ret;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
int
|
|
|
3604df |
gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
- dict_t *migrate_data)
|
|
|
3604df |
+ dict_t *migrate_data, int *perrno)
|
|
|
3604df |
{
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
fd_t *fd = NULL;
|
|
|
3604df |
@@ -2757,7 +2755,6 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
int throttle_up = 0;
|
|
|
3604df |
struct dir_dfmeta *dir_dfmeta = NULL;
|
|
|
3604df |
int should_commit_hash = 1;
|
|
|
3604df |
- int fop_errno = 0;
|
|
|
3604df |
|
|
|
3604df |
gf_log (this->name, GF_LOG_INFO, "migrate data called on %s",
|
|
|
3604df |
loc->path);
|
|
|
3604df |
@@ -2784,7 +2781,7 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
DHT_MSG_MIGRATE_DATA_FAILED,
|
|
|
3604df |
"Migrate data failed: Failed to open dir %s",
|
|
|
3604df |
loc->path);
|
|
|
3604df |
- fop_errno = -ret;
|
|
|
3604df |
+ *perrno = -ret;
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
@@ -2930,11 +2927,10 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
loc, conf, defrag, fd,
|
|
|
3604df |
migrate_data, dir_dfmeta,
|
|
|
3604df |
xattr_req,
|
|
|
3604df |
- &should_commit_hash);
|
|
|
3604df |
+ &should_commit_hash, perrno);
|
|
|
3604df |
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
- fop_errno = errno;
|
|
|
3604df |
- gf_log ("this->name", GF_LOG_WARNING, "Found "
|
|
|
3604df |
+ gf_log (this->name, GF_LOG_WARNING, "Found "
|
|
|
3604df |
"error from gf_defrag_get_entry");
|
|
|
3604df |
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
@@ -2994,7 +2990,6 @@ out:
|
|
|
3604df |
ret = 2;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
- errno = fop_errno;
|
|
|
3604df |
return ret;
|
|
|
3604df |
}
|
|
|
3604df |
int
|
|
|
3604df |
@@ -3180,6 +3175,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
inode_t *linked_inode = NULL, *inode = NULL;
|
|
|
3604df |
dht_conf_t *conf = NULL;
|
|
|
3604df |
int should_commit_hash = 1;
|
|
|
3604df |
+ int perrno = 0;
|
|
|
3604df |
|
|
|
3604df |
conf = this->private;
|
|
|
3604df |
if (!conf) {
|
|
|
3604df |
@@ -3200,7 +3196,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
if (-ret == ENOENT || -ret == ESTALE) {
|
|
|
3604df |
- gf_msg (this->name, GF_LOG_INFO, errno,
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_INFO, -ret,
|
|
|
3604df |
DHT_MSG_DIR_LOOKUP_FAILED,
|
|
|
3604df |
"Dir:%s renamed or removed. Skipping",
|
|
|
3604df |
loc->path);
|
|
|
3604df |
@@ -3218,10 +3214,11 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
|
|
|
3604df |
if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER) &&
|
|
|
3604df |
(defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX)) {
|
|
|
3604df |
- ret = gf_defrag_process_dir (this, defrag, loc, migrate_data);
|
|
|
3604df |
+ ret = gf_defrag_process_dir (this, defrag, loc, migrate_data,
|
|
|
3604df |
+ &perrno);
|
|
|
3604df |
|
|
|
3604df |
- if (ret && ret != 2) {
|
|
|
3604df |
- if (errno == ENOENT || errno == ESTALE) {
|
|
|
3604df |
+ if (ret && (ret != 2)) {
|
|
|
3604df |
+ if (perrno == ENOENT || perrno == ESTALE) {
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
goto out;
|
|
|
3604df |
} else {
|
|
|
3604df |
@@ -3376,7 +3373,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
|
|
3604df |
NULL, NULL);
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (-ret == ENOENT || -ret == ESTALE) {
|
|
|
3604df |
- gf_msg (this->name, GF_LOG_INFO, errno,
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_INFO, -ret,
|
|
|
3604df |
DHT_MSG_DIR_LOOKUP_FAILED,
|
|
|
3604df |
"Dir:%s renamed or removed. "
|
|
|
3604df |
"Skipping", loc->path);
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|