public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>,
	Swen Schillig <swen@vnet.ibm.com>
Subject: [patch 4/8] zfcp: Fix request list handling in error path
Date: Tue, 04 Nov 2008 16:35:08 +0100	[thread overview]
Message-ID: <20081104153628.245547000@de.ibm.com> (raw)
In-Reply-To: 20081104153504.606043000@de.ibm.com

[-- Attachment #1: fsf-error.diff --]
[-- Type: text/plain, Size: 2120 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

Fix the handling of the request list in the error path:
 - Use irqsave for the lock as in the good path.
 - Before removing the request, check if it is still in the list, a
   call to dismiss_all might have changed the list in between.
 - zfcp_qdio_send does not change the queue counters on failure,
   trying revert something is wrong, so remove this.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_fsf.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

--- a/drivers/s390/scsi/zfcp_fsf.c	2008-11-04 14:44:19.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_fsf.c	2008-11-04 14:44:22.000000000 +0100
@@ -770,7 +770,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req
 static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
 {
 	struct zfcp_adapter *adapter = req->adapter;
-	struct zfcp_qdio_queue *req_q = &adapter->req_q;
 	unsigned long flags;
 	int idx;
 
@@ -780,19 +779,15 @@ static int zfcp_fsf_req_send(struct zfcp
 	list_add_tail(&req->list, &adapter->req_list[idx]);
 	spin_unlock_irqrestore(&adapter->req_list_lock, flags);
 
-	req->qdio_outb_usage = atomic_read(&req_q->count);
+	req->qdio_outb_usage = atomic_read(&adapter->req_q.count);
 	req->issued = get_clock();
 	if (zfcp_qdio_send(req)) {
-		/* Queues are down..... */
 		del_timer(&req->timer);
-		spin_lock(&adapter->req_list_lock);
-		zfcp_reqlist_remove(adapter, req);
-		spin_unlock(&adapter->req_list_lock);
-		/* undo changes in request queue made for this request */
-		atomic_add(req->sbal_number, &req_q->count);
-		req_q->first -= req->sbal_number;
-		req_q->first += QDIO_MAX_BUFFERS_PER_Q;
-		req_q->first %= QDIO_MAX_BUFFERS_PER_Q; /* wrap */
+		spin_lock_irqsave(&adapter->req_list_lock, flags);
+		/* lookup request again, list might have changed */
+		if (zfcp_reqlist_find_safe(adapter, req))
+			zfcp_reqlist_remove(adapter, req);
+		spin_unlock_irqrestore(&adapter->req_list_lock, flags);
 		zfcp_erp_adapter_reopen(adapter, 0, 116, req);
 		return -EIO;
 	}

-- 

  parent reply	other threads:[~2008-11-04 15:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 15:35 [patch 0/8] zfcp fixes for 2.6.28 Christof Schmitt
2008-11-04 15:35 ` [patch 1/8] zfcp: Dont clear reference from SCSI device to unit Christof Schmitt
2008-11-04 15:35 ` [patch 2/8] zfcp: fix req_list_locking Christof Schmitt
2008-11-04 15:35 ` [patch 3/8] zfcp: fix mempool usage for status_read requests Christof Schmitt
2008-11-05 17:46   ` James Bottomley
2008-11-06 15:16     ` Christof Schmitt
2008-11-04 15:35 ` Christof Schmitt [this message]
2008-11-04 15:35 ` [patch 5/8] zfcp: Fix cast warning Christof Schmitt
2008-11-04 15:35 ` [patch 6/8] zfcp: Wait for port scan to complete when setting adapter online Christof Schmitt
2008-11-04 15:35 ` [patch 7/8] zfcp: fix erp timeout cleanup for port open requests Christof Schmitt
2008-11-04 15:35 ` [patch 8/8] zfcp: Fix hexdump data in s390dbf traces Christof Schmitt

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=20081104153628.245547000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=swen@vnet.ibm.com \
    /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