diff options
author | Susant Palai <spalai@redhat.com> | 2017-01-05 11:46:20 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-01-08 03:03:50 -0800 |
commit | e509aebc2d6aacd25d9b7530c8722c3475eea055 (patch) | |
tree | a31ddce37e47b1d2dd76860aac66c9e9b881ebc3 | |
parent | 11008e8b2a81a9b23d7a98e82db7a0ce0d9dbafb (diff) |
dht/rebalance: remove errno check for failure detection
> BUG: 1410355
> Change-Id: I867419ca36a81ef7209e6911a46c1c2c898b8eab
> Signed-off-by: Susant Palai <spalai@redhat.com>
> Reviewed-on: http://review.gluster.org/16328
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
(cherry picked from commit 451ca272d12f2d49522c845d53585520f71525f8)
Change-Id: If05094346fc1fc48f4982db6a195740171ae2fad
BUG: 1410764
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/16348
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 1d145855ed7..127996ecf61 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -2351,7 +2351,7 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, loc_t *loc, dht_conf_t *conf, gf_defrag_info_t *defrag, fd_t *fd, dict_t *migrate_data, struct dir_dfmeta *dir_dfmeta, dict_t *xattr_req, - int *should_commit_hash) + int *should_commit_hash, int *perrno) { int ret = -1; char is_linkfile = 0; @@ -2362,7 +2362,6 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, struct dht_container *tmp_container = NULL; xlator_t *hashed_subvol = NULL; xlator_t *cached_subvol = NULL; - int fop_errno = 0; if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) { ret = -1; @@ -2390,7 +2389,7 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, DHT_MSG_MIGRATE_DATA_FAILED, "Readdirp failed. Aborting data migration for " "directory: %s", loc->path); - fop_errno = -ret; + *perrno = -ret; ret = -1; goto out; } @@ -2647,13 +2646,12 @@ out: dict_unref (xattr_rsp); - errno = fop_errno; return ret; } int gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, - dict_t *migrate_data) + dict_t *migrate_data, int *perrno) { int ret = -1; fd_t *fd = NULL; @@ -2673,7 +2671,6 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, int throttle_up = 0; struct dir_dfmeta *dir_dfmeta = NULL; int should_commit_hash = 1; - int fop_errno = 0; gf_log (this->name, GF_LOG_INFO, "migrate data called on %s", loc->path); @@ -2700,7 +2697,7 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, DHT_MSG_MIGRATE_DATA_FAILED, "Migrate data failed: Failed to open dir %s", loc->path); - fop_errno = -ret; + *perrno = -ret; ret = -1; goto out; } @@ -2846,11 +2843,10 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, loc, conf, defrag, fd, migrate_data, dir_dfmeta, xattr_req, - &should_commit_hash); + &should_commit_hash, perrno); if (ret) { - fop_errno = errno; - gf_log ("this->name", GF_LOG_WARNING, "Found " + gf_log (this->name, GF_LOG_WARNING, "Found " "error from gf_defrag_get_entry"); ret = -1; @@ -2910,7 +2906,6 @@ out: ret = 2; } - errno = fop_errno; return ret; } int @@ -3096,6 +3091,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, inode_t *linked_inode = NULL, *inode = NULL; dht_conf_t *conf = NULL; int should_commit_hash = 1; + int perrno = 0; conf = this->private; if (!conf) { @@ -3116,7 +3112,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, } if (-ret == ENOENT || -ret == ESTALE) { - gf_msg (this->name, GF_LOG_INFO, errno, + gf_msg (this->name, GF_LOG_INFO, -ret, DHT_MSG_DIR_LOOKUP_FAILED, "Dir:%s renamed or removed. Skipping", loc->path); @@ -3134,10 +3130,11 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER) && (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX)) { - ret = gf_defrag_process_dir (this, defrag, loc, migrate_data); + ret = gf_defrag_process_dir (this, defrag, loc, migrate_data, + &perrno); - if (ret && ret != 2) { - if (errno == ENOENT || errno == ESTALE) { + if (ret && (ret != 2)) { + if (perrno == ENOENT || perrno == ESTALE) { ret = 0; goto out; } else { @@ -3292,7 +3289,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, NULL, NULL); if (ret) { if (-ret == ENOENT || -ret == ESTALE) { - gf_msg (this->name, GF_LOG_INFO, errno, + gf_msg (this->name, GF_LOG_INFO, -ret, DHT_MSG_DIR_LOOKUP_FAILED, "Dir:%s renamed or removed. " "Skipping", loc->path); |