[PATCHSET v30.1 05/15] xfs: create temporary files for online repair

Darrick J. Wong
2024-03-27T01:47:37Z

Hi all,

As mentioned earlier, the repair strategy for file-based metadata is to
build a new copy in a temporary file and swap the file fork mappings
with the metadata inode. We've built the atomic extent swap facility,
so now we need to build a facility for handling private temporary files.

The first step is to teach the filesystem to ignore the temporary files.
We'll mark them as PRIVATE in the VFS so that the kernel security
modules will leave it alone. The second step is to add the online
repair code the ability to create a temporary file and reap extents from
the temporary file after the extent swap.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been running on the djcloud for months with no problems. 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=repair-tempfiles
---
Commits in this patchset:
* xfs: hide private inodes from bulkstat and handle functions
* xfs: create temporary files and directories for online repair
* xfs: refactor live buffer invalidation for repairs
* xfs: add the ability to reap entire inode forks
---
fs/xfs/Makefile | 1
fs/xfs/scrub/parent.c | 2
fs/xfs/scrub/reap.c | 445 +++++++++++++++++++++++++++++++++++++++++++++--
fs/xfs/scrub/reap.h | 21 ++
fs/xfs/scrub/scrub.c | 3
fs/xfs/scrub/scrub.h | 4
fs/xfs/scrub/tempfile.c | 251 +++++++++++++++++++++++++++
fs/xfs/scrub/tempfile.h | 28 +++
fs/xfs/scrub/trace.h | 96 ++++++++++
fs/xfs/xfs_export.c | 2
fs/xfs/xfs_inode.c | 3
fs/xfs/xfs_inode.h | 2
fs/xfs/xfs_iops.c | 3
fs/xfs/xfs_itable.c | 8 +
14 files changed, 843 insertions(+), 26 deletions(-)
create mode 100644 fs/xfs/scrub/tempfile.c
create mode 100644 fs/xfs/scrub/tempfile.h