Hi all, I've been noticing sporadic failures with djwong-dev with xfs/141, which is a looping log recovery test. The primary symptoms have been that online fsck reports incorrect free extent counts after some number of recovery loops. The root cause seems to be the use of sb_frextents in the xfs_mount for incore reservations to transactions -- if someone calls xfs_log_sb while there's a transaction with an rtx reservation running, the artificially low value will then get logged to disk! If that's the /last/ time anyone logs the superblock before the log goes down, then recovery will replay the incorrect value into the live superblock. Effectively, we leak the rt extents. So, the first thing to do is to fix log recovery to recompute frextents from the rt bitmap so that we can catch and correct ondisk metadata; and the second fix is to create a percpu counter to track both ondisk and incore rtextent counts, similar to how m_fdblocks relates to sb_fdblocks. The next thing to do after this is to fix xfs_repair to check frextents and the rt bitmap/summary files, since it doesn't check the ondisk values against its own observations. v2: better comments, move the frextents recalc to the summary counter recalc function, dont require empty transactions to check rtbitmap 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=frextents-fixes-5.18 --- fs/xfs/libxfs/xfs_rtbitmap.c | 9 ++-- fs/xfs/libxfs/xfs_sb.c | 5 ++ fs/xfs/scrub/rtbitmap.c | 9 ++-- fs/xfs/xfs_fsmap.c | 6 +-- fs/xfs/xfs_fsops.c | 5 -- fs/xfs/xfs_icache.c | 9 +++- fs/xfs/xfs_mount.c | 91 ++++++++++++++++++++++++------------------ fs/xfs/xfs_mount.h | 19 +++++++-- fs/xfs/xfs_rtalloc.c | 38 ++++++++++++++++++ fs/xfs/xfs_rtalloc.h | 9 +++- fs/xfs/xfs_super.c | 14 ++++++ fs/xfs/xfs_trans.c | 43 +++++++++++++++++--- 12 files changed, 187 insertions(+), 70 deletions(-)