Commit b6e3c840 authored by Vasu Dev's avatar Vasu Dev Committed by James Bottomley

[SCSI] libfc: avoid exchanges collision during lport reset

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: default avatarVasu Dev <vasu.dev@intel.com>
Tested-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarYi Zou <yi.zou@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 14fc315f
...@@ -1793,6 +1793,9 @@ static void fc_exch_pool_reset(struct fc_lport *lport, ...@@ -1793,6 +1793,9 @@ static void fc_exch_pool_reset(struct fc_lport *lport,
goto restart; goto restart;
} }
} }
pool->next_index = 0;
pool->left = FC_XID_UNKNOWN;
pool->right = FC_XID_UNKNOWN;
spin_unlock_bh(&pool->lock); spin_unlock_bh(&pool->lock);
} }
...@@ -2281,6 +2284,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, ...@@ -2281,6 +2284,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport,
goto free_mempool; goto free_mempool;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
pool = per_cpu_ptr(mp->pool, cpu); pool = per_cpu_ptr(mp->pool, cpu);
pool->next_index = 0;
pool->left = FC_XID_UNKNOWN; pool->left = FC_XID_UNKNOWN;
pool->right = FC_XID_UNKNOWN; pool->right = FC_XID_UNKNOWN;
spin_lock_init(&pool->lock); spin_lock_init(&pool->lock);
......
...@@ -1030,16 +1030,8 @@ static void fc_lport_enter_reset(struct fc_lport *lport) ...@@ -1030,16 +1030,8 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
FCH_EVT_LIPRESET, 0); FCH_EVT_LIPRESET, 0);
fc_vports_linkchange(lport); fc_vports_linkchange(lport);
fc_lport_reset_locked(lport); fc_lport_reset_locked(lport);
if (lport->link_up) { 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);
fc_lport_enter_flogi(lport); fc_lport_enter_flogi(lport);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment