public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ibmvfc: Delay NPIV login retry and add retries
@ 2008-12-03 17:02 Brian King
  2008-12-03 17:38 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Brian King @ 2008-12-03 17:02 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, brking


Adds a delay prior to retrying a failed NPIV login. This fixes
a scenario if the backing fibre channel adapter is getting reset
due to an EEH event, NPIV login will fail. Currently, ibmvfc
retries three times very quickly, resets the CRQ and tries one
more time. If the adapter is getting reset due to EEH, this isn't
enough time. This adds a delay prior to retrying a failed NPIV
login and also increments the number of retries.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 drivers/scsi/ibmvscsi/ibmvfc.c |   17 ++++++++++++-----
 drivers/scsi/ibmvscsi/ibmvfc.h |    4 +++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_host_init_delay drivers/scsi/ibmvscsi/ibmvfc.c
--- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_host_init_delay	2008-11-25 08:15:17.000000000 -0600
+++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c	2008-11-26 15:04:21.000000000 -0600
@@ -561,7 +561,7 @@ static void ibmvfc_init_host(struct ibmv
 	struct ibmvfc_target *tgt;
 
 	if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
-		if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
+		if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
 			dev_err(vhost->dev,
 				"Host initialization retries exceeded. Taking adapter offline\n");
 			ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
@@ -845,11 +845,12 @@ static void ibmvfc_reset_host(struct ibm
 static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost)
 {
 	if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
-		if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
+		vhost->delay_init = 1;
+		if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
 			dev_err(vhost->dev,
 				"Host initialization retries exceeded. Taking adapter offline\n");
 			ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
-		} else if (vhost->init_retries == IBMVFC_MAX_INIT_RETRIES)
+		} else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES)
 			__ibmvfc_reset_host(vhost);
 		else
 			ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT);
@@ -2756,7 +2757,7 @@ static void ibmvfc_init_tgt(struct ibmvf
 static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt,
 				  void (*job_step) (struct ibmvfc_target *))
 {
-	if (++tgt->init_retries > IBMVFC_MAX_INIT_RETRIES) {
+	if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) {
 		ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
 		wake_up(&tgt->vhost->work_wait_q);
 	} else
@@ -3613,7 +3614,13 @@ static void ibmvfc_do_work(struct ibmvfc
 		break;
 	case IBMVFC_HOST_ACTION_INIT:
 		BUG_ON(vhost->state != IBMVFC_INITIALIZING);
-		vhost->job_step(vhost);
+		if (vhost->delay_init) {
+			vhost->delay_init = 0;
+			spin_unlock_irqrestore(vhost->host->host_lock, flags);
+			ssleep(5);
+			return;
+		} else
+			vhost->job_step(vhost);
 		break;
 	case IBMVFC_HOST_ACTION_QUERY:
 		list_for_each_entry(tgt, &vhost->targets, queue)
diff -puN drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_host_init_delay drivers/scsi/ibmvscsi/ibmvfc.h
--- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_host_init_delay	2008-11-25 08:15:17.000000000 -0600
+++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.h	2008-11-26 15:04:21.000000000 -0600
@@ -43,7 +43,8 @@
 #define IBMVFC_MAX_DISC_THREADS	4
 #define IBMVFC_TGT_MEMPOOL_SZ		64
 #define IBMVFC_MAX_CMDS_PER_LUN	64
-#define IBMVFC_MAX_INIT_RETRIES	3
+#define IBMVFC_MAX_HOST_INIT_RETRIES	6
+#define IBMVFC_MAX_TGT_INIT_RETRIES		3
 #define IBMVFC_DEV_LOSS_TMO		(5 * 60)
 #define IBMVFC_DEFAULT_LOG_LEVEL	2
 #define IBMVFC_MAX_CDB_LEN		16
@@ -673,6 +674,7 @@ struct ibmvfc_host {
 	int discovery_threads;
 	int client_migrated;
 	int reinit;
+	int delay_init;
 	int events_to_log;
 #define IBMVFC_AE_LINKUP	0x0001
 #define IBMVFC_AE_LINKDOWN	0x0002
_

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ibmvfc: Delay NPIV login retry and add retries
  2008-12-03 17:02 [PATCH 1/2] ibmvfc: Delay NPIV login retry and add retries Brian King
@ 2008-12-03 17:38 ` James Bottomley
  2008-12-03 21:54   ` Brian King
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2008-12-03 17:38 UTC (permalink / raw)
  To: Brian King; +Cc: linux-scsi

On Wed, 2008-12-03 at 11:02 -0600, Brian King wrote:
> Adds a delay prior to retrying a failed NPIV login. This fixes
> a scenario if the backing fibre channel adapter is getting reset
> due to an EEH event, NPIV login will fail. Currently, ibmvfc
> retries three times very quickly, resets the CRQ and tries one
> more time. If the adapter is getting reset due to EEH, this isn't
> enough time. This adds a delay prior to retrying a failed NPIV
> login and also increments the number of retries.

Are these for 2.6.28 or 2.6.29?  The descriptions make them sound like
2.6.28 bug fixes.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ibmvfc: Delay NPIV login retry and add retries
  2008-12-03 17:38 ` James Bottomley
@ 2008-12-03 21:54   ` Brian King
  0 siblings, 0 replies; 3+ messages in thread
From: Brian King @ 2008-12-03 21:54 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

James Bottomley wrote:
> On Wed, 2008-12-03 at 11:02 -0600, Brian King wrote:
>> Adds a delay prior to retrying a failed NPIV login. This fixes
>> a scenario if the backing fibre channel adapter is getting reset
>> due to an EEH event, NPIV login will fail. Currently, ibmvfc
>> retries three times very quickly, resets the CRQ and tries one
>> more time. If the adapter is getting reset due to EEH, this isn't
>> enough time. This adds a delay prior to retrying a failed NPIV
>> login and also increments the number of retries.
> 
> Are these for 2.6.28 or 2.6.29?  The descriptions make them sound like
> 2.6.28 bug fixes.

They can go in 2.6.29. They are bug fixes, but they are not easily hit.
They apply on top of all the other ibmvfc patches queued for 2.6.29.

Thanks,

Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-03 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 17:02 [PATCH 1/2] ibmvfc: Delay NPIV login retry and add retries Brian King
2008-12-03 17:38 ` James Bottomley
2008-12-03 21:54   ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox