From db022ef7ecca77cbecbcc4c046b6d3aafd2cb86f Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Wed, 21 May 2014 17:47:03 +0530 Subject: cluster/dht: Fix min-free-disk calculations when quota-deem-statfs is on PROBLEM: As part of file creation, DHT sends a statfs call to all of its sub-volumes and expects in return the local space consumption and availability on each one of them. This information is used by DHT to ensure that atleast min-free-disk amount of space is left on each sub-volume in the event that there ARE other sub-volumes with more space available. But when quota-deem-statfs is enabled, quota xlator on every brick unwinds the statfs call with volume-wide consumption of disk space. This leads to miscalculation in min-free-disk algo, thereby misleading DHT at some point, into thinking all sub-volumes have equal available space, in which case DHT keeps sending new file creates to subvol-0, causing it to become 100% full at some point although there ARE other subvols with ample space available. FIX: The fix is to make quota_statfs() behave as if quota xlator weren't enabled, thereby making every brick return only its local consumption and disk space availability. Change-Id: I211371a1eddb220037bd36a128973938ea8124c2 BUG: 1099890 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/7845 Tested-by: Gluster Build System Reviewed-by: Raghavendra G Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-diskusage.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/dht/src/dht-diskusage.c') diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index fe3955ecbb7..d035aca2665 100644 --- a/xlators/cluster/dht/src/dht-diskusage.c +++ b/xlators/cluster/dht/src/dht-diskusage.c @@ -135,6 +135,7 @@ int dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc) { int i = 0; + int ret = -1; dht_conf_t *conf = NULL; call_frame_t *statfs_frame = NULL; dht_local_t *statfs_local = NULL; @@ -164,12 +165,25 @@ dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc) goto err; } + statfs_local->params = dict_new (); + if (!statfs_local->params) + goto err; + + ret = dict_set_int8 (statfs_local->params, + 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"); + goto err; + } + statfs_local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { STACK_WIND (statfs_frame, dht_du_info_cbk, conf->subvolumes[i], conf->subvolumes[i]->fops->statfs, - &tmp_loc, NULL); + &tmp_loc, statfs_local->params); } conf->last_stat_fetch.tv_sec = tv.tv_sec; -- cgit