Hi all, A couple of weeks ago, I was triaging an unexpected quota counter failure report coming from xfs_repair after the online repair code rebuilt a directory. It turned out that the XFS implementation of linkat does not reserve any quota, which means that a directory expansion can increase the quota block count beyond the hard limit. Similar problems exist in the unlink, rmdir, and rename code, so we'll fix those problems at the same time. Note: this series does not try to fix a similar bug in the swapext code, because estimating the necessary quota reservation is very very tricky. I wrote all that estimation code as the first part of the atomic extent exchange patchset, so I'll leave that there. v2: fix unlink and rename, since Dave suggested it If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=quota-reservations-5.18 --- fs/xfs/xfs_inode.c | 67 +++++++++++++++++++++++++++-------------- fs/xfs/xfs_trans.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans.h | 3 ++ 3 files changed, 133 insertions(+), 23 deletions(-)