• Allison Henderson's avatar
    xfs: Fix double unlock in defer capture code · 7b3ec2b2
    Allison Henderson authored
    The new deferred attr patch set uncovered a double unlock in the
    recent port of the defer ops capture and continue code.  During log
    recovery, we're allowed to hold buffers to a transaction that's being
    used to replay an intent item.  When we capture the resources as part
    of scheduling a continuation of an intent chain, we call xfs_buf_hold
    to retain our reference to the buffer beyond the transaction commit,
    but we do /not/ call xfs_trans_bhold to maintain the buffer lock.
    This means that xfs_defer_ops_continue needs to relock the buffers
    before xfs_defer_restore_resources joins then tothe new transaction.
    
    Additionally, the buffers should not be passed back via the dres
    structure since they need to remain locked unlike the inodes.  So
    simply set dr_bufs to zero after populating the dres structure.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarAllison Henderson <allison.henderson@oracle.com>
    Reviewed-by: default avatarChandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    7b3ec2b2
xfs_defer.c 26.7 KB