]> www.infradead.org Git - users/hch/xfs.git/commit
xfs: move repair temporary files to the metadata directory tree
authorDarrick J. Wong <djwong@kernel.org>
Mon, 23 Sep 2024 20:41:03 +0000 (13:41 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:10:43 +0000 (18:10 -0700)
commita92b8b700cff24ece12a3990d0b42a6930958319
treea42319ca4d98bd4ba74f5a9e51abc68ce1a47e14
parent68fe21687bf51c3ce9c96c64d99d84e8f6812365
xfs: move repair temporary files to the metadata directory tree

Due to resource acquisition rules, we have to create the ondisk
temporary files used to stage a filesystem repair before we can acquire
a reference to the inode that we actually want to repair.  Therefore,
we do not know at tempfile creation time whether the tempfile will
belong to the regular directory tree or the metadata directory tree.

This distinction becomes important when the swapext code tries to figure
out the quota accounting of the two files whose mappings are being
swapped.  The swapext code assumes that accounting updates are required
for a file if dqattach attaches dquots.  Metadir files are never
accounted in quota, which means that swapext must not update the quota
accounting when swapping in a repaired directory/xattr/rtbitmap structure.

Prior to the swapext call, therefore, both files must be marked as
METADIR for dqattach so that dqattach will ignore them.  Add support for
a repair tempfile to be switched to the metadir tree and switched back
before being released so that ifree will just free the file.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/common.c
fs/xfs/scrub/tempfile.c
fs/xfs/scrub/tempfile.h