• Darrick J. Wong's avatar
    xfs: hold quota inode ILOCK_EXCL until the end of dqalloc · eae44cb3
    Darrick J. Wong authored
    Online fsck depends on callers holding ILOCK_EXCL from the time they
    decide to update a block mapping until after they've updated the reverse
    mapping records to guarantee the stability of both mapping records.
    Unfortunately, the quota code drops ILOCK_EXCL at the first transaction
    roll in the dquot allocation process, which breaks that assertion.  This
    leads to sporadic failures in the online rmap repair code if the repair
    code grabs the AGF after bmapi_write maps a new block into the quota
    file's data fork but before it can finish the deferred rmap update.
    
    Fix this by rewriting the function to hold the ILOCK until after the
    transaction commit like all other bmap updates do, and get rid of the
    dqread wrapper that does nothing but complicate the codebase.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    eae44cb3
xfs_dquot.c 34.9 KB