summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarak Sason Rofman <bsasonro@redhat.com>2020-09-24 16:46:46 +0300
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-10-01 04:01:35 +0000
commit66deb99e745c47abf527bde41164fd4034e97035 (patch)
treeed5c73150fb4bf6b8e80e639495194e293439d41
parent8489d42bde51455da0fedc531a5fe1df8a24a858 (diff)
DHT - Fixing memory allocation crash
The allocation dir_dfmeta = GF_CALLOC(1, sizeof(*dir_dfmeta), gf_common_mt_pointer); seems to cause a crash. From the logs: [2020-09-24 13:10:13.225935 +0000] I [dht-rebalance.c:3273:gf_defrag_process_dir] 0-dist-dht: migrate data called on /dir1 [2020-09-24 13:10:13.226587 +0000] E [mem-pool.c:61:gf_mem_set_acct_info] (-->/usr/local/lib/glusterfs/9dev/xlator/cluster/distribute.so(+0x18e60) [0x7f4b1f71ee60] -->/usr/local/lib/glusterfs/9dev/xlator/cluster/distribute.so(+0x173ab) [0x7f4b1f71d3ab] -->/usr/local/lib/libglusterfs.so.0(+0x4d8e5) [0x7f4b357668e5] ) 0-: Assertion failed: type <= mem_acct->num_types [2020-09-24 13:10:13.226623 +0000] E [mem-pool.c:61:gf_mem_set_acct_info] (-->/usr/local/lib/glusterfs/9dev/xlator/cluster/distribute.so(+0x18e60) [0x7f4b1f71ee60] -->/usr/local/lib/glusterfs/9dev/xlator/cluster/distribute.so(+0x173d3) [0x7f4b1f71d3d3] -->/usr/local/lib/libglusterfs.so.0(+0x4d8e5) [0x7f4b357668e5] ) 0-: Assertion failed: type <= mem_acct->num_types The following change fixes that crash. fixes: #1511 Change-Id: Ibf605648981f7108e863c91a80370cf077ad7c4a Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index e901947..34db19c 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -3278,6 +3278,7 @@ 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;
+ xlator_t *old_THIS = NULL;
gf_log(this->name, GF_LOG_INFO, "migrate data called on %s", loc->path);
gettimeofday(&dir_start, NULL);
@@ -3290,6 +3291,9 @@ gf_defrag_process_dir(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
goto out;
}
+ old_THIS = THIS;
+ THIS = this;
+
dir_dfmeta = GF_CALLOC(1, sizeof(*dir_dfmeta), gf_common_mt_pointer);
if (!dir_dfmeta) {
gf_log(this->name, GF_LOG_ERROR, "dir_dfmeta is NULL");
@@ -3505,7 +3509,7 @@ gf_defrag_process_dir(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
loc->path, elapsed / 1e6);
ret = 0;
out:
-
+ THIS = old_THIS;
gf_defrag_free_dir_dfmeta(dir_dfmeta, local_subvols_cnt);
if (xattr_req)
@@ -3522,6 +3526,7 @@ out:
defrag->num_dirs_processed++;
return ret;
}
+
int
gf_defrag_settle_hash(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
dict_t *fix_layout)