From 3ab5d0672c7ef8a46e1b711e1593748bed407d32 Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Wed, 23 Oct 2013 16:10:31 +0530 Subject: features/quota: Correct the statfs calculation when set limit is beyond ... actual disk space. Fixed one of the cases where 'df' values data show wrong when the quota limit is greater than back-end disk space. Change-Id: I09fb71a37602c6f3daf6b91dd3fd19b7f5f76817 BUG: 969461 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/6126 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/quota/src/quota.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'xlators/features/quota') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 2812a2b13a9..416d9ce652a 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3561,11 +3561,9 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, buf->f_blocks = blocks; avail = buf->f_blocks - usage; - avail = (avail >= 0) ? avail : 0; + avail = max (avail, 0); - if (buf->f_bfree > avail) { - buf->f_bfree = avail; - } + buf->f_bfree = avail; /* * We have to assume that the total assigned quota * won't cause us to dip into the reserved space, -- cgit