All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET v4 0/6] xfs: fix incorrect reserve pool calculations and reporting
@ 2022-03-27 16:58 Darrick J. Wong
  2022-03-27 16:58 ` [PATCH 1/6] xfs: document the XFS_ALLOC_AGFL_RESERVE constant Darrick J. Wong
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Darrick J. Wong @ 2022-03-27 16:58 UTC (permalink / raw)
  To: djwong; +Cc: Dave Chinner, Brian Foster, linux-xfs, bfoster, david

Hi all,

Last week, I was running xfs/306 (which formats a single-AG 20MB
filesystem) with an fstests configuration that specifies a 1k blocksize
and a specially crafted log size that will consume 7/8 of the space
(17920 blocks, specifically) in that AG.  This resulted mount hanging on
the infinite loop in xfs_reserve_blocks because we overestimate the
number of blocks that xfs_mod_fdblocks will give us, and the code
retries forever.

v2: Initially, this was a single patch that fixed the calculation and
transformed the loop into a finite loop.  However, further discussion
revealed several more issues:

 * People had a hard time grokking that the "alloc_set_aside" is
   actually the amount of space we hide so that a bmbt split will always
   succeed;
 * The author didn't understand what XFS_ALLOC_AGFL_RESERVE actually
   mean or whether it was correctly calculated;
 * The "alloc_set_aside" underestimated the blocks needed to handle any
   bmap btree split;
 * Both statfs and XFS_IOC_FSCOUNTS forgot to exclude the amount of
   space used by the free space btrees on behalf of per-AG reservations,
   leading to overreporting of available space;
 * The loop control change really should have been separate.

Hence, this patchset has now grown to six patches to address each of
these issues separately.

v3: only add one helper for calculating the total fdblocks setaside and
tighten some documentation

v4: It turns out I was wrong about the purpose of alloc_set_aside, so
fix the new comments in the first patch, delete the last patch, and
leave the "btree split calculations" for another patchset.  Eliminate
the looping behavior in xfs_reserve_blocks, and fix a case where we
could race to set the pool size and thereby overfill 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=reserve-block-fixes-5.18
---
 fs/xfs/libxfs/xfs_alloc.c |   28 +++++++++++++++++++----
 fs/xfs/libxfs/xfs_alloc.h |    1 -
 fs/xfs/xfs_fsops.c        |   54 ++++++++++++++++++---------------------------
 fs/xfs/xfs_mount.c        |    2 +-
 fs/xfs/xfs_mount.h        |   15 +++++++++++++
 fs/xfs/xfs_super.c        |    3 ++-
 6 files changed, 63 insertions(+), 40 deletions(-)


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-04-06 18:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-27 16:58 [PATCHSET v4 0/6] xfs: fix incorrect reserve pool calculations and reporting Darrick J. Wong
2022-03-27 16:58 ` [PATCH 1/6] xfs: document the XFS_ALLOC_AGFL_RESERVE constant Darrick J. Wong
2022-03-28  1:18   ` Dave Chinner
2022-04-01  5:51   ` Christoph Hellwig
2022-03-27 16:58 ` [PATCH 2/6] xfs: don't include bnobt blocks when reserving free block pool Darrick J. Wong
2022-04-06 16:39   ` Christoph Hellwig
2022-03-27 16:58 ` [PATCH 3/6] xfs: remove infinite loop " Darrick J. Wong
2022-03-28  1:20   ` Dave Chinner
2022-04-06 16:40   ` Christoph Hellwig
2022-03-27 16:58 ` [PATCH 4/6] xfs: always succeed at setting the reserve pool size Darrick J. Wong
2022-03-28  1:21   ` Dave Chinner
2022-04-06 16:40   ` Christoph Hellwig
2022-03-27 16:58 ` [PATCH 5/6] xfs: fix overfilling of reserve pool Darrick J. Wong
2022-03-28  1:22   ` Dave Chinner
2022-04-06 16:42   ` Christoph Hellwig
2022-03-27 16:58 ` [PATCH 6/6] xfs: don't report reserved bnobt space as available Darrick J. Wong
2022-04-06 16:43   ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.