[Cluster-devel] [GFS2 0/3] fallocate and quota fixes

Steven Whitehouse swhiteho at redhat.com
Wed Feb 25 09:19:09 UTC 2015


Hi,

On 25/02/15 05:17, Abhi Das wrote:
> This is a revised version of the patches required to properly fix the
> fallocate quota issue described in bz1174295
>
> patch1: This patch supplies gfs2_quota_check() with the number of blocks
> 	the caller intends to allocate in the current operation, resulting
> 	in a more accurate quota check.
>
> patch2: gfs2_quota_check() and gfs2_inplace_reserve() return the number
> 	of blocks available subject to quota limits and rgrp size
> 	respectively. The difference from previous versions of this patch
> 	is that we return the available blocks even on success.
>
> patch3: The fallocate() function uses the features of patch2 to determine
> 	how many total blocks are available for allocation and uses them
> 	right away, instead of guessing inefficiently.
>
> The behavior of quota enforcement is altered by this patchset.
> i.   Quotas are exceeded (a warning message is also issued to syslog) before
>       the actual usage blocks exceed the imposed limit. In fact, the actual
>       usage can never exceed the limit. Whenever it is determined that the
>       completion of an operation will cause a quota to exceed its limit, such
>       an operation is aborted with -EDQUOT and a 'quota exceeded' message is
>       dispatched.
> ii.  The gfs2_write_calc_reserv()/calc_max_reserv() functions are used to
>       map between available blocks and the data bytes that can be written
>       using them. Typically, for large files, some blocks are used up for
>       metadata and only the remaining blocks can be used for data. Example:
>       To write only a handful of bytes that would easily fit in one block, we
>       might have to allocate an extra bunch of intermediate metadata blocks.
>       If we had only 1 block left in our allotted quota, this operation would
>       likely fail.
>
> The functions mentioned in ii. are not very efficient. They always compute
> the worst case number of extra blocks required and it is often the case that
> not all those extra blocks are used. We need to find a better algorithm to
> get a tighter estimate on the blocks needed for a given number of bytes.
>
> I've run some basic tests and things seem to be holding up. The failing case
> in bz1174295 is fixed using this patchset. I'll do test build and pass it on
> to Nate to test with.
>
> Abhi Das (3):
>    gfs2: perform quota checks against allocation parameters
>    gfs2: allow quota_check and inplace_reserve to return available blocks
>    gfs2: allow fallocate to max out quotas/fs efficiently
>
>   fs/gfs2/aops.c   |  6 ++---
>   fs/gfs2/bmap.c   |  2 +-
>   fs/gfs2/file.c   | 75 ++++++++++++++++++++++++++++++++++++++------------------
>   fs/gfs2/incore.h |  3 ++-
>   fs/gfs2/inode.c  | 18 ++++++++------
>   fs/gfs2/quota.c  | 40 ++++++++++++++++++++++--------
>   fs/gfs2/quota.h  |  8 +++---
>   fs/gfs2/rgrp.c   | 12 +++++++--
>   fs/gfs2/rgrp.h   |  6 +++--
>   fs/gfs2/xattr.c  |  2 +-
>   10 files changed, 117 insertions(+), 55 deletions(-)
>

This looks good, but definitely needs careful testing,

Steve.




More information about the Cluster-devel mailing list