• Darrick J. Wong's avatar
    xfs: fix an AGI lock acquisition ordering problem in xrep_dinode_findmode · 2afd5276
    Darrick J. Wong authored
    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.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    2afd5276
iscan.h 2.84 KB