From 53ac35ebd24cffa420a73c3b2ab43c994c9b7861 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 Reviewed-on: http://review.gluster.org/6840 Reviewed-by: Vijay Bellur --- xlators/features/quota/src/quota.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 665999860..f563873d0 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3505,13 +3505,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