Hi Dave, Please pull this branch with changes for xfs. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit ecc73f8a58c7844b04186726f8699ba97cec2ef9: xfs: update copyright years for scrub/ files (2023-04-11 18:59:57 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/scrub-drain-intents-6.4_2023-04-11 for you to fetch changes up to 88accf17226733088923635b580779a3c86b6f23: xfs: scrub should use ECHRNG to signal that the drain is needed (2023-04-11 19:00:00 -0700) ---------------------------------------------------------------- xfs: drain deferred work items when scrubbing [v24.5] The design doc for XFS online fsck contains a long discussion of the eventual consistency models in use for XFS metadata. In that chapter, we note that it is possible for scrub to collide with a chain of deferred space metadata updates, and proposes a lightweight solution: The use of a pending-intents counter so that scrub can wait for the system to drain all chains. This patchset implements that scrub drain. The first patch implements the basic mechanism, and the subsequent patches reduce the runtime overhead by converting the implementation to use sloppy counters and introducing jump labels to avoid walking into scrub hooks when it isn't running. This last paradigm repeats elsewhere in this megaseries. v23.1: make intent items take an active ref to the perag structure and document why we bump and drop the intent counts when we do Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> ---------------------------------------------------------------- Darrick J. Wong (5): xfs: add a tracepoint to report incorrect extent refcounts xfs: allow queued AG intents to drain before scrubbing xfs: clean up scrub context if scrub setup returns -EDEADLOCK xfs: minimize overhead of drain wakeups by using jump labels xfs: scrub should use ECHRNG to signal that the drain is needed fs/xfs/Kconfig | 5 ++ fs/xfs/Makefile | 2 + fs/xfs/libxfs/xfs_ag.c | 4 ++ fs/xfs/libxfs/xfs_ag.h | 8 +++ fs/xfs/libxfs/xfs_defer.c | 6 +- fs/xfs/scrub/agheader.c | 9 +++ fs/xfs/scrub/alloc.c | 3 + fs/xfs/scrub/bmap.c | 3 + fs/xfs/scrub/btree.c | 1 + fs/xfs/scrub/common.c | 137 ++++++++++++++++++++++++++++++++++--- fs/xfs/scrub/common.h | 15 ++++ fs/xfs/scrub/dabtree.c | 1 + fs/xfs/scrub/fscounters.c | 7 ++ fs/xfs/scrub/health.c | 2 + fs/xfs/scrub/ialloc.c | 2 + fs/xfs/scrub/inode.c | 3 + fs/xfs/scrub/quota.c | 3 + fs/xfs/scrub/refcount.c | 9 ++- fs/xfs/scrub/repair.c | 3 + fs/xfs/scrub/rmap.c | 3 + fs/xfs/scrub/scrub.c | 63 ++++++++++++----- fs/xfs/scrub/scrub.h | 12 +++- fs/xfs/scrub/trace.h | 69 +++++++++++++++++++ fs/xfs/xfs_bmap_item.c | 12 +++- fs/xfs/xfs_drain.c | 166 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_drain.h | 87 ++++++++++++++++++++++++ fs/xfs/xfs_extfree_item.c | 4 +- fs/xfs/xfs_linux.h | 1 + fs/xfs/xfs_refcount_item.c | 4 +- fs/xfs/xfs_rmap_item.c | 4 +- fs/xfs/xfs_trace.h | 71 +++++++++++++++++++ 31 files changed, 680 insertions(+), 39 deletions(-) create mode 100644 fs/xfs/xfs_drain.c create mode 100644 fs/xfs/xfs_drain.h