summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/quota.h
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2018-02-20 16:03:24 +0100
committerBob Peterson <rpeterso@redhat.com>2018-03-08 17:26:20 +0100
commit174d1232ebc84fcde8f5889d1171c9c7e74a10a7 (patch)
tree755eabd7f57703c96d0979a52cc555d0c0deecb3 /fs/gfs2/quota.h
parentMerge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost (diff)
downloadlinux-174d1232ebc84fcde8f5889d1171c9c7e74a10a7.tar.xz
linux-174d1232ebc84fcde8f5889d1171c9c7e74a10a7.zip
gfs2: Fix fallocate chunk size
The chunk size of allocations in __gfs2_fallocate is calculated incorrectly. The size can collapse, causing __gfs2_fallocate to allocate one block at a time, which is very inefficient. This needs fixing in two places: In gfs2_quota_lock_check, always set ap->allowed to UINT_MAX to indicate that there is no quota limit. This fixes callers that rely on ap->allowed to be set even when quotas are off. In __gfs2_fallocate, reset max_blks to UINT_MAX in each iteration of the loop to make sure that allocation limits from one resource group won't spill over into another resource group. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.h')
-rw-r--r--fs/gfs2/quota.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 5e47c935a515..836f29480be6 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -45,6 +45,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
int ret;
+
+ ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
return 0;
ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);