|
|
21ab4e |
From 6a24eed225ba8e325af3585959407e4fe36ec89f Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Susant Palai <spalai@redhat.com>
|
|
|
21ab4e |
Date: Wed, 26 Jul 2017 17:12:03 +0530
|
|
|
21ab4e |
Subject: [PATCH 581/587] cluster/dht: rebalance min-free-disk fix
|
|
|
21ab4e |
|
|
|
21ab4e |
To calculate available space on a subvolume we used to do
|
|
|
21ab4e |
the following in __dht_check_free_space.
|
|
|
21ab4e |
|
|
|
21ab4e |
post_availspace = (dst_statfs.f_bavail * dst_statfs.f_frsize) - stbuf->ia_size
|
|
|
21ab4e |
|
|
|
21ab4e |
Now to subtracting the file size from available space is tricky here.
|
|
|
21ab4e |
Sometime available space will be lesser than the file size and since all the
|
|
|
21ab4e |
participating members in calculation are unsigned int, the result is a large
|
|
|
21ab4e |
number (integer overflow).
|
|
|
21ab4e |
|
|
|
21ab4e |
Solution: We do not need to subtract the file size from the space available,
|
|
|
21ab4e |
since fallocate would have reserved file size space already.
|
|
|
21ab4e |
|
|
|
21ab4e |
> Change-Id: I4f724358c44b9911933742ff3ff8d55b3dfda1cb
|
|
|
21ab4e |
> BUG: 1475282
|
|
|
21ab4e |
> Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/17876
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
21ab4e |
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I4f724358c44b9911933742ff3ff8d55b3dfda1cb
|
|
|
21ab4e |
BUG: 1474812
|
|
|
21ab4e |
Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/114017
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/cluster/dht/src/dht-rebalance.c | 18 ++++++++++++------
|
|
|
21ab4e |
1 file changed, 12 insertions(+), 6 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
index c4d58ed..896db79 100644
|
|
|
21ab4e |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
21ab4e |
@@ -881,8 +881,7 @@ __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc
|
|
|
21ab4e |
dht_layout_t *layout = NULL;
|
|
|
21ab4e |
uint64_t src_statfs_blocks = 1;
|
|
|
21ab4e |
uint64_t dst_statfs_blocks = 1;
|
|
|
21ab4e |
- double post_availspace = 0;
|
|
|
21ab4e |
- double post_percent = 0;
|
|
|
21ab4e |
+ double post_availspacepercent = 0;
|
|
|
21ab4e |
int i = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
xdata = dict_new ();
|
|
|
21ab4e |
@@ -975,9 +974,12 @@ __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc
|
|
|
21ab4e |
check_avail_space:
|
|
|
21ab4e |
|
|
|
21ab4e |
if (conf->disk_unit == 'p' && dst_statfs.f_blocks) {
|
|
|
21ab4e |
- post_availspace = (dst_statfs.f_bavail * dst_statfs.f_frsize) - stbuf->ia_size;
|
|
|
21ab4e |
- post_percent = (post_availspace * 100) / (dst_statfs.f_blocks * dst_statfs.f_frsize);
|
|
|
21ab4e |
- if (post_percent < conf->min_free_disk) {
|
|
|
21ab4e |
+ post_availspacepercent = (dst_statfs.f_bavail * 100) / dst_statfs.f_blocks;
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0, "file : %s, post_availspacepercent : %lf "
|
|
|
21ab4e |
+ "f_bavail : %lu min-free-disk: %lf", loc->path,
|
|
|
21ab4e |
+ post_availspacepercent, dst_statfs.f_bavail, conf->min_free_disk);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (post_availspacepercent < conf->min_free_disk) {
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_WARNING, 0, 0,
|
|
|
21ab4e |
"Write will cross min-free-disk for "
|
|
|
21ab4e |
"file - %s on subvol - %s. Looking "
|
|
|
21ab4e |
@@ -991,7 +993,11 @@ check_avail_space:
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
if (conf->disk_unit != 'p' &&
|
|
|
21ab4e |
- ((dst_statfs.f_bavail * dst_statfs.f_frsize) - stbuf->ia_size) < conf->min_free_disk) {
|
|
|
21ab4e |
+ ((dst_statfs.f_bavail * dst_statfs.f_frsize) < conf->min_free_disk)) {
|
|
|
21ab4e |
+ gf_msg_debug (this->name, 0, "file : %s, destination frsize: %lu "
|
|
|
21ab4e |
+ "f_bavail : %lu min-free-disk: %lf", loc->path,
|
|
|
21ab4e |
+ dst_statfs.f_frsize, dst_statfs.f_bavail, conf->min_free_disk);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_WARNING, 0, 0, "Write will cross "
|
|
|
21ab4e |
"min-free-disk for file - %s on subvol - %s. Looking "
|
|
|
21ab4e |
"for new subvol", loc->path, to->name);
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|