Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] bnx2fc: Fix race condition between IO completion and abort

When IO is successfully completed while an abort is pending, eh_abort
incorrectly assumes that abort failed and performes recovery by issuing
cleanup. Howerver, cleanup timesout as the firmware has no clue about
this IO. Fix this by checking if the IO has already completed.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Bhanu Prakash Gollapudi and committed by
James Bottomley
5d78f175 c13d2b6d

+5 -2
+5 -2
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 1270 1270 1271 1271 spin_lock_bh(&tgt->tgt_lock); 1272 1272 io_req->wait_for_comp = 0; 1273 - if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, 1274 - &io_req->req_flags))) { 1273 + if (test_bit(BNX2FC_FLAG_IO_COMPL, &io_req->req_flags)) { 1274 + BNX2FC_IO_DBG(io_req, "IO completed in a different context\n"); 1275 + rc = SUCCESS; 1276 + } else if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, 1277 + &io_req->req_flags))) { 1275 1278 /* Let the scsi-ml try to recover this command */ 1276 1279 printk(KERN_ERR PFX "abort failed, xid = 0x%x\n", 1277 1280 io_req->xid);