mbox series

[PATCHSET,v11,0/3] xfs: hold ILOCK during deferred dir ops

Message ID 168080824260.615105.7346122486674782401.stgit@frogsfrogsfrogs (mailing list archive)
Headers show
Series xfs: hold ILOCK during deferred dir ops | expand

Message

Darrick J. Wong April 6, 2023, 7:14 p.m. UTC
Hi all,

Currently, directory updates (link, unlink, rename) only hold the ILOCK
for the first transaction in the chain.  The first transaction is where
we perform all the directory updates, so this has sufficed to coordinate
access to the directory itself.

With parent pointers, we need to hold both directories and children
ILOCKed across the entire directory update transaction chain so that
other threads never see an inconsistent edge state (parent -> child and
parent <- child).  Prepare for this by making the directory update code
hold all the ILOCKs.

There's a subtle issue with online rmapbt repair that gets fixed here.
Space allocations performed as part of a directory update result in
deferred rmap updates later in the chain.  With the current code, the
directory ILOCK (but not the IOLOCK) is dropped before the rmapbt
updates are performed.  As a result, the online rmapbt repair scanner
has to hold each directory's IOLOCK and ILOCK to coordinate with writer
threads correctly.  This change makes it so that online repair no longer
has to hold the directory IOLOCK, which makes the locking model here
consistent with the other repair scanners.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=pptrs-hold-ilocks
---
 fs/xfs/xfs_inode.c   |   65 ++++++++++++++++++++++++++++++++++++++------------
 fs/xfs/xfs_qm.c      |    4 ++-
 fs/xfs/xfs_symlink.c |    2 ++
 fs/xfs/xfs_trans.c   |    9 +++++--
 4 files changed, 61 insertions(+), 19 deletions(-)