[PATCHSET v29.0 21/40] xfsprogs: set and validate dir/attr block owners

Darrick J. Wong
2023-12-31T19:45:10Z

Hi all,

There are a couple of significatn changes that need to be made to the
directory and xattr code before we can support online repairs of those
data structures.

The first change is because online repair is designed to use libxfs to
create a replacement dir/xattr structure in a temporary file, and use
atomic extent swapping to commit the corrected structure. To avoid the
performance hit of walking every block of the new structure to rewrite
the owner number, we instead change libxfs to allow callers of the dir
and xattr code the ability to set an explicit owner number to be written
into the header fields of any new blocks that are created.

The second change is to update the dir/xattr code to actually *check*
the owner number in each block that is read off the disk, since we don't
currently do that.

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=dirattr-validate-owners

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=dirattr-validate-owners
---
db/attrset.c | 2 +
db/namei.c | 6 +-
libxfs/libxfs_api_defs.h | 3 +
libxfs/xfs_attr.c | 10 +--
libxfs/xfs_attr_leaf.c | 59 +++++++++++++---
libxfs/xfs_attr_leaf.h | 4 +
libxfs/xfs_attr_remote.c | 13 ++--
libxfs/xfs_bmap.c | 1
libxfs/xfs_da_btree.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++
libxfs/xfs_da_btree.h | 3 +
libxfs/xfs_dir2.c | 5 +
libxfs/xfs_dir2.h | 4 +
libxfs/xfs_dir2_block.c | 44 +++++++-----
libxfs/xfs_dir2_data.c | 17 +++--
libxfs/xfs_dir2_leaf.c | 99 +++++++++++++++++++++------
libxfs/xfs_dir2_node.c | 44 +++++++-----
libxfs/xfs_dir2_priv.h | 11 ++-
libxfs/xfs_swapext.c | 7 +-
repair/phase6.c | 3 +
19 files changed, 402 insertions(+), 101 deletions(-)