diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2012-04-24 18:26:03 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-05-22 05:01:26 -0400 |
commit | 92886c9c97fd20dde26a12cd9f43cd3c786bc8ea (patch) | |
tree | f596efc0039eb8db32baa03d9a3f9a2ac09f7dda /drivers/scsi/bnx2fc | |
parent | c1bb4f33de87ad18ace1cf484ed0c78683d933a1 (diff) |
[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>
Diffstat (limited to 'drivers/scsi/bnx2fc')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_io.c | 16 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_tgt.c | 10 |
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 43258c3c90ae..4f7453b9e41e 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -810,8 +810,22 @@ retry_tmf: | |||
810 | spin_lock_bh(&tgt->tgt_lock); | 810 | spin_lock_bh(&tgt->tgt_lock); |
811 | 811 | ||
812 | io_req->wait_for_comp = 0; | 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 | set_bit(BNX2FC_FLAG_TM_TIMEOUT, &io_req->req_flags); | 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 | spin_unlock_bh(&tgt->tgt_lock); | 830 | spin_unlock_bh(&tgt->tgt_lock); |
817 | 831 | ||
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c index d3ee231a5680..082a25c3117e 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c | |||
@@ -185,6 +185,16 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) | |||
185 | BUG_ON(rc); | 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 | list_for_each_safe(list, tmp, &tgt->els_queue) { | 198 | list_for_each_safe(list, tmp, &tgt->els_queue) { |
189 | i++; | 199 | i++; |
190 | io_req = (struct bnx2fc_cmd *)list; | 200 | io_req = (struct bnx2fc_cmd *)list; |