On Tue, Apr 02, 2024 at 10:18:31PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > While reviewing the next patch which fixes an ABBA deadlock between the > AGI and a directory ILOCK, someone asked a question about why we're > holding the AGI in the first place. The reason for that is to quiesce > the inode structures for that AG while we do a repair. > > I then realized that the xrep_dinode_findmode invokes xchk_iscan_iter, > which walks the inobts (and hence the AGIs) to find all the inodes. > This itself is also an ABBA vector, since the damaged inode could be in > AG 5, which we hold while we scan AG 0 for directories. 5 -> 0 is not > allowed. > > To address this, modify the iscan to allow trylock of the AGI buffer > using the flags argument to xfs_ialloc_read_agi that the previous patch > added. Well, I guess we need this as a quick fix, but any scheme based on trylock and return is just fundamentally broken. Same for the next one.