• Brian Foster's avatar
    xfs: buffer ->bi_end_io function requires irq-safe lock · 9bdd9bd6
    Brian Foster authored
    Reports have surfaced of a lockdep splat complaining about an
    irq-safe -> irq-unsafe locking order in the xfs_buf_bio_end_io() bio
    completion handler. This only occurs when I/O errors are present
    because bp->b_lock is only acquired in this context to protect
    setting an error on the buffer. The problem is that this lock can be
    acquired with the (request_queue) q->queue_lock held. See
    scsi_end_request() or ata_qc_schedule_eh(), for example.
    
    Replace the locked test/set of b_io_error with a cmpxchg() call.
    This eliminates the need for the lock and thus the lock ordering
    problem goes away.
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    9bdd9bd6
xfs_buf.c 44.1 KB