linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bhanu Prakash Gollapudi" <bprakash@broadcom.com>
To: JBottomley@Parallels.com, linux-scsi@vger.kernel.org
Cc: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Subject: [v2 PATCH 3/4] bnx2fc: cleanup task management IO when it times out.
Date: Tue, 24 Apr 2012 15:26:03 -0700	[thread overview]
Message-ID: <1335306364-31449-4-git-send-email-bprakash@broadcom.com> (raw)
In-Reply-To: <1335306364-31449-1-git-send-email-bprakash@broadcom.com>

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>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c  |   16 +++++++++++++++-
 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 4843b42..27074ee 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -810,8 +810,22 @@ retry_tmf:
 	spin_lock_bh(&tgt->tgt_lock);
 
 	io_req->wait_for_comp = 0;
-	if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags)))
+	if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags))) {
 		set_bit(BNX2FC_FLAG_TM_TIMEOUT, &io_req->req_flags);
+		if (io_req->on_tmf_queue) {
+			list_del_init(&io_req->link);
+			io_req->on_tmf_queue = 0;
+		}
+		io_req->wait_for_comp = 1;
+		bnx2fc_initiate_cleanup(io_req);
+		spin_unlock_bh(&tgt->tgt_lock);
+		rc = wait_for_completion_timeout(&io_req->tm_done,
+						 BNX2FC_FW_TIMEOUT);
+		spin_lock_bh(&tgt->tgt_lock);
+		io_req->wait_for_comp = 0;
+		if (!rc)
+			kref_put(&io_req->refcount, bnx2fc_cmd_release);
+	}
 
 	spin_unlock_bh(&tgt->tgt_lock);
 
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index d3ee231..082a25c 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)
 		BUG_ON(rc);
 	}
 
+	list_for_each_safe(list, tmp, &tgt->active_tm_queue) {
+		i++;
+		io_req = (struct bnx2fc_cmd *)list;
+		list_del_init(&io_req->link);
+		io_req->on_tmf_queue = 0;
+		BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n");
+		if (io_req->wait_for_comp)
+			complete(&io_req->tm_done);
+	}
+
 	list_for_each_safe(list, tmp, &tgt->els_queue) {
 		i++;
 		io_req = (struct bnx2fc_cmd *)list;
-- 
1.7.0.6



  parent reply	other threads:[~2012-04-24 22:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 22:26 [v2 PATCH 0/4] bnx2fc version 1.0.11 Bhanu Prakash Gollapudi
2012-04-24 22:26 ` [v2 PATCH 1/4] bnx2fc: Allow FLOGI to be retried when receiving bad responses Bhanu Prakash Gollapudi
2012-04-24 22:26 ` [v2 PATCH 2/4] bnx2fc: Decrememnt io ref count when abort times out Bhanu Prakash Gollapudi
2012-04-24 22:26 ` Bhanu Prakash Gollapudi [this message]
2012-05-04  8:49   ` [v2 PATCH 3/4] bnx2fc: cleanup task management IO when it " Mike Christie
2012-04-24 22:26 ` [v2 PATCH 4/4] Bumped version to 1.0.11 Bhanu Prakash Gollapudi
2012-05-21 16:18 ` [v2 PATCH 0/4] bnx2fc version 1.0.11 Bhanu Prakash Gollapudi
2012-05-21 18:06   ` James Bottomley
2012-05-21 18:35     ` Bhanu Prakash Gollapudi
2012-05-22  8:45       ` James Bottomley
2012-05-22 17:06         ` Bhanu Prakash Gollapudi
     [not found] <4FA85912.2030800@broadcom.com>
2012-05-07 23:31 ` [v2 PATCH 3/4] bnx2fc: cleanup task management IO when it times out Bhanu Prakash Gollapudi
2012-05-08  0:14   ` Mike Christie
2012-05-08  0:27     ` Mike Christie
2012-05-08  0:36       ` Bhanu Prakash Gollapudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335306364-31449-4-git-send-email-bprakash@broadcom.com \
    --to=bprakash@broadcom.com \
    --cc=JBottomley@Parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).