diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-10-28 18:19:30 -0700 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-10-31 10:07:01 -0700 |
commit | bf9e4330e4108e0dbab8ebf300bf7998551b9589 (patch) | |
tree | 8603fe9df6ef7e3d02ca864335e76e7a8230d347 /xlators/cluster | |
parent | 5beb3a886c3bb12dfb0a9515e366de49859c2be1 (diff) |
rebalance: ``check_free_space`` should ignore quota_statfs
quota_statfs() returns aggregated details of space usage
of bricks this causes distribute to be confused during
``rebalance``, where ``statfs()`` values are used to
schedule file migration.
We can make sure the values of ``statfs`` are from
individual bricks by selectively instructing
``quota_statfs()`` to return non aggregated values.
Change-Id: I1397faeee66a1b9c26709cfda693286d227a4170
BUG: 1158262
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8996
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 3c976b113fa..85499737e30 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -491,13 +491,31 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc, struct statvfs dst_statfs = {0,}; int ret = -1; xlator_t *this = NULL; + dict_t *xdata = NULL; uint64_t src_statfs_blocks = 1; uint64_t dst_statfs_blocks = 1; this = THIS; - ret = syncop_statfs (from, loc, &src_statfs); + xdata = dict_new (); + if (!xdata) { + errno = ENOMEM; + gf_log (this->name, GF_LOG_ERROR, + "failed to allocate dictionary"); + goto out; + } + + ret = dict_set_int8 (xdata, GF_INTERNAL_IGNORE_DEEM_STATFS, 1); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set " + GF_INTERNAL_IGNORE_DEEM_STATFS" in dict"); + ret = -1; + goto out; + } + + ret = syncop_statfs (from, loc, xdata, &src_statfs, NULL); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_MIGRATE_FILE_FAILED, @@ -507,7 +525,7 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc, goto out; } - ret = syncop_statfs (to, loc, &dst_statfs); + ret = syncop_statfs (to, loc, xdata, &dst_statfs, NULL); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_MIGRATE_FILE_FAILED, @@ -541,10 +559,13 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc, gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_MIGRATE_FILE_FAILED, - "data movement attempted from node (%s) with" - " higher disk space to a node (%s) with " - "lesser disk space (%s)", from->name, - to->name, loc->path); + "data movement attempted from node " + "(%s:%"PRIu64") with higher disk space " + "to a node (%s:%"PRIu64") with lesser " + "disk space, file { blocks:%"PRIu64", " + "name:(%s) }", from->name, src_statfs_blocks, + to->name, dst_statfs_blocks, + stbuf->ia_blocks, loc->path); /* this is not a 'failure', but we don't want to consider this as 'success' too :-/ */ @@ -557,15 +578,17 @@ check_avail_space: GF_DISK_SECTOR_SIZE) < stbuf->ia_blocks) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_MIGRATE_FILE_FAILED, - "data movement attempted from node (%s) with " - "to node (%s) which does not have required free space" - " for %s", from->name, to->name, loc->path); + "data movement attempted from node (%s) to node (%s) " + "which does not have required free space for (%s)", + from->name, to->name, loc->path); ret = -1; goto out; } ret = 0; out: + if (xdata) + dict_unref (xdata); return ret; } @@ -1510,7 +1533,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_MIGRATE_FILE_FAILED, - "Migrate file failed:%s lookup failed", + "Migrate file failed:%s lookup failed", entry_loc.path); ret = -1; continue; |