summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
authorKevin Vigor <kvigor@fb.com>2017-01-09 09:16:05 -0800
committerKevin Vigor <kvigor@fb.com>2017-01-09 09:16:05 -0800
commitb49d30a20efee06eb5a5007a244f3c474366cb35 (patch)
tree317639c5e045d9bbbcbd14e16d423b3ac86e4f70 /xlators/cluster/dht/src
parentc5145b464e6ebc77021fe4ebef4aaf8312a323aa (diff)
parent068e4f345f51438d252b1e330ca7049bd4a67e03 (diff)
Merge remote-tracking branch 'origin/release-3.8' into 3.8-merge
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-helper.c7
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c29
2 files changed, 20 insertions, 16 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 255c0823aac..5e7f5fa4eb1 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -1320,6 +1320,9 @@ unlock:
UNLOCK(&inode->lock);
out:
+ if (dict) {
+ dict_unref (dict);
+ }
loc_wipe (&tmp_loc);
@@ -1588,6 +1591,10 @@ unlock:
ret = 0;
out:
+ if (dict) {
+ dict_unref (dict);
+ }
+
loc_wipe (&tmp_loc);
return ret;
}
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 10fd878041e..ebc8a9c2492 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);