Skip to contentSkip to conversation

mpt fusion - fibre channel target discovery prematurely terminates

PATCH In review Michael Reed 2 participants 4 messages May 18, 2006 – May 22, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 mpt fusion - fibre channel target discovery prematurely terminates

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.

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.

drivers/message/fusion/mptfc.c +22 -2
@@ -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);
 	}
 
#1 lore raw
Quoted 7 lines · Michael Reed

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.

mpt_config() only returns EAGAIN when it's out of message frames. That should be a very transient condition, so if this rarely occurs anyway, why not just put an msleep(10) on the condition and then retry? It would save all the requeue logic.

James

#2 lore raw
Quoted 6 lines · James Bottomley
Quoted 5 lines · Michael Reed

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.

Quoted 7 lines
Quoted 2 lines

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

mpt_config() only returns EAGAIN when it's out of message frames. That should be a very transient condition, so if this rarely occurs anyway, why not just put an msleep(10) on the condition and then retry? It would save all the requeue logic.

It's not so transient during reset processing. I've measured 10 to 15 seconds of elapsed time. But, it always eventually succeeds.

Mike

Quoted 4 lines

James

#3 lore raw
Quoted 10 lines · Michael Reed
Quoted 8 lines · James Bottomley
Quoted 7 lines · Michael Reed

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.

Quoted 7 lines
Quoted 4 lines

mpt_config() only returns EAGAIN when it's out of message frames. That should be a very transient condition, so if this rarely occurs anyway, why not just put an msleep(10) on the condition and then retry? It would save all the requeue logic.

It's not so transient during reset processing. I've measured 10 to 15 seconds of elapsed time. But, it always eventually succeeds.

Well, I should have said that the event occurs with some regularity during reset processing. And that the duration of the EAGAIN response is 10 to 15 seconds. I'd rather reschedule than msleep.

Mike

Quoted 7 lines

Mike

Quoted 3 lines

James