[GIT PULL 3/18] xfs: online repair of file link counts

Darrick J. Wong
2024-02-24T01:29:44Z

The following changes since commit 96ed2ae4a9b06b417e1c20c086c77755a43284bf:

xfs: repair dquots based on live quotacheck results (2024-02-22 12:30:57 -0800)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/scrub-nlinks-6.9_2024-02-23

for you to fetch changes up to 6b631c60c90a1e5264bc9bcdca2c0adb492d7a62:

xfs: teach repair to fix file nlinks (2024-02-22 12:31:00 -0800)

----------------------------------------------------------------
xfs: online repair of file link counts [v29.3 03/18]

Now that we've created the infrastructure to perform live scans of every
file in the filesystem and the necessary hook infrastructure to observe
live updates, use it to scan directories to compute the correct link
counts for files in the filesystem, and reset those link counts.

This patchset creates a tailored readdir implementation for scrub
because the regular version has to cycle ILOCKs to copy information to
userspace. We can't cycle the ILOCK during the nlink scan and we don't
need all the other VFS support code (maintaining a readdir cursor and
translating XFS structures to VFS structures and back) so it was easier
to duplicate the code.

This has been running on the djcloud for months with no problems. Enjoy!

Signed-off-by: Darrick J. Wong <djwong@kernel.org>

----------------------------------------------------------------
Darrick J. Wong (4):
xfs: report health of inode link counts
xfs: teach scrub to check file nlinks
xfs: track directory entry updates during live nlinks fsck
xfs: teach repair to fix file nlinks

fs/xfs/Makefile | 2 +
fs/xfs/libxfs/xfs_fs.h | 4 +-
fs/xfs/libxfs/xfs_health.h | 4 +-
fs/xfs/scrub/common.c | 3 +
fs/xfs/scrub/common.h | 1 +
fs/xfs/scrub/health.c | 1 +
fs/xfs/scrub/nlinks.c | 930 +++++++++++++++++++++++++++++++++++++++++++
fs/xfs/scrub/nlinks.h | 102 +++++
fs/xfs/scrub/nlinks_repair.c | 223 +++++++++++
fs/xfs/scrub/repair.h | 2 +
fs/xfs/scrub/scrub.c | 9 +
fs/xfs/scrub/scrub.h | 5 +-
fs/xfs/scrub/stats.c | 1 +
fs/xfs/scrub/trace.c | 2 +
fs/xfs/scrub/trace.h | 183 ++++++++-
fs/xfs/xfs_health.c | 1 +
fs/xfs/xfs_inode.c | 117 ++++++
fs/xfs/xfs_inode.h | 31 ++
fs/xfs/xfs_mount.h | 3 +
fs/xfs/xfs_super.c | 2 +
fs/xfs/xfs_symlink.c | 1 +
21 files changed, 1623 insertions(+), 4 deletions(-)
create mode 100644 fs/xfs/scrub/nlinks.c
create mode 100644 fs/xfs/scrub/nlinks.h
create mode 100644 fs/xfs/scrub/nlinks_repair.c