From 63638748d744377d899e9ee0b5e7831d7c1c2496 Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Fri, 27 Dec 2013 15:39:19 +0530 Subject: features/quota: Handle the corner case in statfs call Problem: Even though limit is not set quota used to send 'quota-deem-statfs' key in the dictionary resulting in incorrect calculations. Change-Id: I643cb35cca6648e40f1c745135280876958ddaa9 BUG: 1046894 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/6607 Tested-by: Gluster Build System Reviewed-by: Raghavendra G --- xlators/features/quota/src/quota.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/features/quota') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index c42b23027..d46247241 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3461,13 +3461,13 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ctx->hard_lim <= 0) { inode_ctx_get (inode->table->root, this, &value); ctx = (quota_inode_ctx_t *)(unsigned long) value; - if (!ctx) + if (!ctx || ctx->hard_lim < 0) goto unwind; } - usage = (ctx->size) / buf->f_bsize; + { /* statfs is adjusted in this code block */ + usage = (ctx->size) / buf->f_bsize; - if (ctx->hard_lim > 0) { blocks = ctx->hard_lim / buf->f_bsize; buf->f_blocks = blocks; -- cgit