linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Reed <mdr@sgi.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 1/6] mpt fusion - fibre channel target discovery prematurely terminates
Date: Thu, 18 May 2006 14:59:32 -0500	[thread overview]
Message-ID: <446CD224.6060806@sgi.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

mpt_config() can return EAGAIN.  When this happens, fibre channel target
discovery can prematurely terminate with fewer than the total number of
targets discovered.  This patch detects EAGAIN and reschedules the scan
work.

Generally, this situation only occurs when the lsiutil program is being
used to reset the board.

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




[-- Attachment #2: 01-mptfc_eagain.patch --]
[-- Type: text/x-patch, Size: 2073 bytes --]

mpt_config() can return EAGAIN.  When this happens, fibre channel target
discovery can prematurely terminate with fewer than the total number of
targets discovered.  This patch detects EAGAIN and reschedules the scan
work.

Generally, this situation only occurs when the lsiutil program is being
used to reset the board.

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


--- rc3u/drivers/message/fusion/mptfc.c	2006-05-01 16:06:13.311966423 -0500
+++ rc3/drivers/message/fusion/mptfc.c	2006-05-03 14:16:47.669834844 -0500
@@ -634,6 +634,7 @@
 	MPT_ADAPTER		*ioc = (MPT_ADAPTER *)arg;
 	int			ii;
 	int			work_to_do;
+	int			rc=0;
 	u64			pn;
 	unsigned long		flags;
 	struct mptfc_rport_info *ri;
@@ -651,9 +652,13 @@
 		 * will reregister existing rports
 		 */
 		for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
-			(void) mptbase_GetFcPortPage0(ioc, ii);
+			rc = mptbase_GetFcPortPage0(ioc, ii);
+			if (rc == -EAGAIN)
+				break;
 			mptfc_init_host_attr(ioc,ii);	/* refresh */
-			mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev);
+			rc = mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev);
+			if (rc == -EAGAIN)
+				break;
 		}
 
 		/* delete devices still missing */
@@ -686,6 +691,20 @@
 		work_to_do = --ioc->fc_rescan_work_count;
 		spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
 	} while (work_to_do);
+
+	/* if last pass failed with EAGAIN, reschedule work for a later attempt */
+	if (rc == -EAGAIN) {
+		spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
+		if (ioc->fc_rescan_work_q) {
+			queue_delayed_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work, HZ);
+			ioc->fc_rescan_work_count = 1;
+		}
+		spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
+		dfcprintk ((MYIOC_s_INFO_FMT
+			"mptfc_rescan.%d: rescheduling work\n",
+			ioc->name,
+			ioc->sh->host_no));
+	}
 }
 
 static int
@@ -981,6 +1000,7 @@
 		spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
 		ioc->fc_rescan_work_q = NULL;
 		spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
+		cancel_delayed_work(&ioc->fc_rescan_work);
 		destroy_workqueue(work_q);
 	}
 

             reply	other threads:[~2006-05-18 19:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 19:59 Michael Reed [this message]
2006-05-20 15:33 ` [PATCH 1/6] mpt fusion - fibre channel target discovery prematurely terminates James Bottomley
2006-05-22 17:31   ` Michael Reed
2006-05-22 17:34     ` Michael Reed
  -- strict thread matches above, loose matches on Subject: below --
2006-05-19 23:41 Moore, Eric
2006-05-22 17:45 Moore, Eric
2006-05-22 17:57 ` James Bottomley
2006-05-22 18:05 ` Michael Reed
2006-05-22 18:15 Moore, Eric
2006-05-22 18:40 ` Michael Reed
2006-05-24 18:48   ` Michael Reed
2006-05-22 23:09 Moore, Eric

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=446CD224.6060806@sgi.com \
    --to=mdr@sgi.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).