]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: use atomic extent swapping to fix user file fork data
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:39 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:00 +0000 (17:01 -0700)
commit784d5b7c02b1292c20ea59e26c23493df49a3ba7
treed84b58947006afb6a8b934bc8b32131e51f66cc5
parent92244687aaebe7939b9f7e24ed4266f958c878ed
xfs: use atomic extent swapping to fix user file fork data

Source kernel commit: 629fdaf5f5b1b7f7107ed4de04e0991a99501ced

Build on the code that was recently added to the temporary repair file
code so that we can atomically switch the contents of any file fork,
even if the fork is in local format.  The upcoming functions to repair
xattrs, directories, and symlinks will need that capability.

Repair can lock out access to these user files by holding IOLOCK_EXCL on
these user files.  Therefore, it is safe to drop the ILOCK of both the
file being repaired and the tempfile being used for staging, and cancel
the scrub transaction.  We do this so that we can reuse the resource
estimation and transaction allocation functions used by a regular file
exchange operation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_exchmaps.c
libxfs/xfs_exchmaps.h