From e44d4e135747b04a5e2b7cfac21f9a3343e071db Mon Sep 17 00:00:00 2001 From: GauravKumarGarg Date: Wed, 12 Nov 2014 17:41:33 +0530 Subject: DHT: cluster.min-free-disk option should validate correctly PROBLEM: Previously gluster accepting input value as a percentage which is out of range [0-100] and accepting input value as a size (unit is byte) which is fractional for option cluster.min-free-disk. FIX: Now with this change it will refer to correct validation function and it will accept value that is in range [0-100] for input value as a percentage and unsigned integer value for input as a size (unit in byte) for option cluster.min-free-disk. Change-Id: Iee1962a100542e146276cfc8a4068abddee2bf2d BUG: 1163108 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/9104 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Raghavendra G Reviewed-by: Vijay Bellur --- libglusterfs/src/common-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 6d03b09a943..39da27d83dd 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1449,8 +1449,7 @@ gf_string2bytesize_uint64 (const char *str, uint64_t *n) } int -gf_string2percent_or_bytesize (const char *str, - uint64_t *n, +gf_string2percent_or_bytesize (const char *str, double *n, gf_boolean_t *is_percent) { double value = 0ULL; @@ -1485,6 +1484,7 @@ gf_string2percent_or_bytesize (const char *str, if (errno == 0) errno = old_errno; + /*Maximum accepted value for 64 bit OS will be (2^14 -1)PB*/ if (tail[0] != '\0') { if (strcasecmp (tail, GF_UNIT_KB_STRING) == 0) value *= GF_UNIT_KB; @@ -1508,7 +1508,7 @@ gf_string2percent_or_bytesize (const char *str, return -1; } - *n = (uint64_t) value; + *n = value; return 0; } -- cgit