[PATCHSET v13.1 2/9] xfs: retain ILOCK during directory updates

Darrick J. Wong
2024-04-10T00:44:39Z

Hi all,

This series changes the directory update code to retain the ILOCK on all
files involved in a rename until the end of the operation. The upcoming
parent pointers patchset applies parent pointers in a separate chained
update from the actual directory update, which is why it is now
necessary to keep the ILOCK instead of dropping it after the first
transaction in the chain.

As a side effect, we no longer need to hold the IOLOCK during an rmapbt
scan of inodes to serialize the scan with ongoing directory updates.

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=retain-ilock-during-dir-ops

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=retain-ilock-during-dir-ops
---
Commits in this patchset:
* xfs: Increase XFS_DEFER_OPS_NR_INODES to 5
* xfs: Increase XFS_QM_TRANS_MAXDQS to 5
* xfs: Hold inode locks in xfs_ialloc
* xfs: Hold inode locks in xfs_trans_alloc_dir
* xfs: Hold inode locks in xfs_rename
* xfs: don't pick up IOLOCK during rmapbt repair scan
* xfs: unlock new repair tempfiles after creation
---
fs/xfs/libxfs/xfs_defer.c | 6 ++-
fs/xfs/libxfs/xfs_defer.h | 8 +++-
fs/xfs/scrub/rmap_repair.c | 16 -------
fs/xfs/scrub/tempfile.c | 2 +
fs/xfs/xfs_dquot.c | 41 ++++++++++++++++++
fs/xfs/xfs_dquot.h | 1
fs/xfs/xfs_inode.c | 98 ++++++++++++++++++++++++++++++++------------
fs/xfs/xfs_inode.h | 2 +
fs/xfs/xfs_qm.c | 4 +-
fs/xfs/xfs_qm.h | 2 -
fs/xfs/xfs_symlink.c | 6 ++-
fs/xfs/xfs_trans.c | 9 +++-
fs/xfs/xfs_trans_dquot.c | 15 ++++---
13 files changed, 156 insertions(+), 54 deletions(-)