Skip to content

fallocate and quota fixes

Bob Peterson cluster-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 3 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 3 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

----- Original Message -----

Quoted 61 lines

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(-)
Quoted 2 lines

--
1.8.1.4

Hi,

ACK to all three.
Now pushed to the for-next branch of the linux-gfs2.git git tree.

Regards,

Bob Peterson