summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2013-12-27 15:39:19 +0530
committerVijay Bellur <vbellur@redhat.com>2014-01-28 22:41:59 -0800
commit53ac35ebd24cffa420a73c3b2ab43c994c9b7861 (patch)
treecda5b6e8e8e802e625602ddfdf82c1e65bc88eeb
parentd952c93588a2533a72efdff4f6853c5fa2dec766 (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> Reviewed-on: http://review.gluster.org/6840 Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-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 6659998..f563873 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;