• Dave Chinner's avatar
    xfs: avoid lockdep false positives in xfs_trans_alloc · 8683edb7
    Dave Chinner authored
    We've had a few reports of lockdep tripping over memory reclaim
    context vs filesystem freeze "deadlocks". They all have looked
    to be false positives on analysis, but it seems that they are
    being tripped because we take freeze references before we run
    a GFP_KERNEL allocation for the struct xfs_trans.
    
    We can avoid this false positive vector just by re-ordering the
    operations in xfs_trans_alloc(). That is. we need allocate the
    structure before we take the freeze reference and enter the GFP_NOFS
    allocation context that follows the xfs_trans around. This prevents
    lockdep from seeing the GFP_KERNEL allocation inside the transaction
    context, and that prevents it from triggering the freeze level vs
    alloc context vs reclaim warnings.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    8683edb7
xfs_trans.c 29.2 KB