[SCSI] libfc: avoid exchanges collision during lport reset
authorVasu Dev <vasu.dev@intel.com>
Fri, 28 Oct 2011 18:34:17 +0000 (11:34 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 31 Oct 2011 09:27:19 +0000 (13:27 +0400)
Currently timer delay is large and is using msleep to avoid
avoid exchanges collision across lport reset, so instead
do this by initializing exches pool indexes during
reset also.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/libfc/fc_exch.c
drivers/scsi/libfc/fc_lport.c

index 81235f36adc1f08bb8a4f49bf24b912e69a47c3f..1b22130035da1e82c1a3cc553cbf08f7334aa126 100644 (file)
@@ -1793,6 +1793,9 @@ restart:
                        goto restart;
                }
        }
+       pool->next_index = 0;
+       pool->left = FC_XID_UNKNOWN;
+       pool->right = FC_XID_UNKNOWN;
        spin_unlock_bh(&pool->lock);
 }
 
@@ -2281,6 +2284,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport,
                goto free_mempool;
        for_each_possible_cpu(cpu) {
                pool = per_cpu_ptr(mp->pool, cpu);
+               pool->next_index = 0;
                pool->left = FC_XID_UNKNOWN;
                pool->right = FC_XID_UNKNOWN;
                spin_lock_init(&pool->lock);
index 628f347404f9b355e1fbe14bd58fdae3f0d7171d..e0fb891335669507fc36c3cb23ad599df4be188e 100644 (file)
@@ -1030,16 +1030,8 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
                           FCH_EVT_LIPRESET, 0);
        fc_vports_linkchange(lport);
        fc_lport_reset_locked(lport);
-       if (lport->link_up) {
-               /*
-                * Wait upto resource allocation time out before
-                * doing re-login since incomplete FIP exchanged
-                * from last session may collide with exchanges
-                * in new session.
-                */
-               msleep(lport->r_a_tov);
+       if (lport->link_up)
                fc_lport_enter_flogi(lport);
-       }
 }
 
 /**