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

[SCSI] bnx2fc: cleanup task management IO when it times out.

When the task management IO times out, or a flush operation is performed while
task management IO is pending, driver is not cleaning up the IO. This patch
cleans up the IO for the above cases.

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
92886c9c c1bb4f33

+25 -1
+15 -1
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 810 810 spin_lock_bh(&tgt->tgt_lock); 811 811 812 812 io_req->wait_for_comp = 0; 813 - if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags))) 813 + if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags))) { 814 814 set_bit(BNX2FC_FLAG_TM_TIMEOUT, &io_req->req_flags); 815 + if (io_req->on_tmf_queue) { 816 + list_del_init(&io_req->link); 817 + io_req->on_tmf_queue = 0; 818 + } 819 + io_req->wait_for_comp = 1; 820 + bnx2fc_initiate_cleanup(io_req); 821 + spin_unlock_bh(&tgt->tgt_lock); 822 + rc = wait_for_completion_timeout(&io_req->tm_done, 823 + BNX2FC_FW_TIMEOUT); 824 + spin_lock_bh(&tgt->tgt_lock); 825 + io_req->wait_for_comp = 0; 826 + if (!rc) 827 + kref_put(&io_req->refcount, bnx2fc_cmd_release); 828 + } 815 829 816 830 spin_unlock_bh(&tgt->tgt_lock); 817 831
+10
drivers/scsi/bnx2fc/bnx2fc_tgt.c
··· 185 185 BUG_ON(rc); 186 186 } 187 187 188 + list_for_each_safe(list, tmp, &tgt->active_tm_queue) { 189 + i++; 190 + io_req = (struct bnx2fc_cmd *)list; 191 + list_del_init(&io_req->link); 192 + io_req->on_tmf_queue = 0; 193 + BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n"); 194 + if (io_req->wait_for_comp) 195 + complete(&io_req->tm_done); 196 + } 197 + 188 198 list_for_each_safe(list, tmp, &tgt->els_queue) { 189 199 i++; 190 200 io_req = (struct bnx2fc_cmd *)list;