public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Reed <mdr@sgi.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: "Moore, Eric" <Eric.Moore@lsi.com>,
	Jeremy Higdon <jeremy@sgi.com>, Robin Holt <holt@sgi.com>,
	kashyap.desai@lsi.com
Subject: [PATCH 1/1] fusion: hold off error recovery while alternate ioc is initializing
Date: Wed, 16 Dec 2009 15:20:49 -0600	[thread overview]
Message-ID: <4B294F31.5030109@sgi.com> (raw)

Fusion FC chips are two function with some shared resources.  During
initialization of one function its driver inhibits the ability of the
other function's driver to allocate message frames by clearing its
"active" flag.  Should mid-layer error recovery be initiated for a
scsi command during this initialization (which can take many seconds)
error recovery will escalate to the level of host reset.  This host
reset might fail resulting in all connected targets being taken offline.

This patch holds off mid-layer error recovery for up to 60 seconds
to permit initialization of the other function to complete.

Applies to scsi-misc.

Signed-off-by: Michael Reed <mdr@sgi.com>

==

--- a/drivers/message/fusion/mptfc.c	2009-12-16 15:09:22.817382765 -0600
+++ b/drivers/message/fusion/mptfc.c	2009-12-16 15:10:31.949380663 -0600
@@ -195,29 +195,31 @@ mptfc_block_error_handler(struct scsi_cm
 	unsigned long		flags;
 	int			ready;
 	MPT_ADAPTER 		*ioc;
+	int			sleep_interval = 1000;
+	int			loops = 60 * sleep_interval;
 
 	hd = shost_priv(SCpnt->device->host);
 	ioc = hd->ioc;
 	spin_lock_irqsave(shost->host_lock, flags);
-	while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
+
+	while ((loops > 0 && ioc->active == 0)
+	 || (ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
+
 		spin_unlock_irqrestore(shost->host_lock, flags);
-		dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
-			"mptfc_block_error_handler.%d: %d:%d, port status is "
-			"DID_IMM_RETRY, deferring %s recovery.\n",
-			ioc->name, ioc->sh->host_no,
-			SCpnt->device->id, SCpnt->device->lun, caller));
-		msleep(1000);
+		msleep(sleep_interval);
+		loops -= sleep_interval;
 		spin_lock_irqsave(shost->host_lock, flags);
 	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
 
-	if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
+	if (ioc->active == 0
+	 || ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
 		dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
-			"%s.%d: %d:%d, failing recovery, "
+			"%s.%d: %d:%d, failing recovery, active %d, "
 			"port state %d, vdevice %p.\n", caller,
 			ioc->name, ioc->sh->host_no,
-			SCpnt->device->id, SCpnt->device->lun, ready,
-			SCpnt->device->hostdata));
+			SCpnt->device->id, SCpnt->device->lun,
+			ioc->active, ready, SCpnt->device->hostdata));
 		return FAILED;
 	}
 	dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT

             reply	other threads:[~2009-12-16 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16 21:20 Michael Reed [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-10 20:32 [PATCH 1/1] fusion: hold off error recovery while alternate ioc is initializing Michael Reed
2010-02-11  9:27 ` Desai, Kashyap
2010-02-11 17:53   ` Bernd Schubert
2010-02-11 18:01     ` James Bottomley
2010-02-11 18:11       ` Bernd Schubert

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=4B294F31.5030109@sgi.com \
    --to=mdr@sgi.com \
    --cc=Eric.Moore@lsi.com \
    --cc=holt@sgi.com \
    --cc=jeremy@sgi.com \
    --cc=kashyap.desai@lsi.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