summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2013-12-27 15:39:19 +0530
committerVijay Bellur <vbellur@redhat.com>2014-01-17 01:21:12 -0800
commit63638748d744377d899e9ee0b5e7831d7c1c2496 (patch)
tree37a13b5a3336633a702a2cef6f6be18484e214d1 /xlators/features/quota
parentc0a14c00bfb9152abdb5cedcf5aa1b9ed9a6ac6a (diff)
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 <vshastry@redhat.com> Reviewed-on: http://review.gluster.org/6607 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/quota')
-rw-r--r--xlators/features/quota/src/quota.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c42b23027e3..d462472417d 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;