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

Steven Whitehouse swhiteho at redhat.com
Wed Mar 18 13:40:22 UTC 2015


Hi,

Acked-by: Steven Whitehouse <swhiteho at redhat.com>

Steve.

On 18/03/15 07:36, 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. These functions don't return error if atleast
> 	ap.min_target (if set) blocks are allocatable.
>
> 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/retrying 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. Note: When min_target is set and allowed blocks are >=
>       min_target, we don't issue an error. It is assumed that the caller will
>       only allocate the allowed blocks.
> 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   | 81 ++++++++++++++++++++++++++++++++++++--------------------
>   fs/gfs2/incore.h |  4 ++-
>   fs/gfs2/inode.c  | 18 +++++++------
>   fs/gfs2/quota.c  | 54 +++++++++++++++++++++++++++----------
>   fs/gfs2/quota.h  |  8 +++---
>   fs/gfs2/rgrp.c   | 20 ++++++++++----
>   fs/gfs2/rgrp.h   |  3 ++-
>   fs/gfs2/xattr.c  |  2 +-
>   10 files changed, 133 insertions(+), 65 deletions(-)
>




More information about the Cluster-devel mailing list