Commit efa93f48 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Fix NPIV deletion by calling wait_for_sess_deletion

Add wait for session deletion to finish before freeing an NPIV scsi host.

Fixes: 726b8548 ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e3dde080
...@@ -2141,6 +2141,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) ...@@ -2141,6 +2141,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
msleep(1000); msleep(1000);
qla24xx_disable_vp(vha); qla24xx_disable_vp(vha);
qla2x00_wait_for_sess_deletion(vha);
vha->flags.delete_progress = 1; vha->flags.delete_progress = 1;
......
...@@ -214,6 +214,7 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *, ...@@ -214,6 +214,7 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,
int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_abort_cmd(srb_t *); int qla24xx_async_abort_cmd(srb_t *);
int qla24xx_post_relogin_work(struct scsi_qla_host *vha); int qla24xx_post_relogin_work(struct scsi_qla_host *vha);
void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *);
/* /*
* Global Functions in qla_mid.c source file. * Global Functions in qla_mid.c source file.
......
...@@ -153,10 +153,15 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) ...@@ -153,10 +153,15 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
{ {
unsigned long flags; unsigned long flags;
int ret; int ret;
fc_port_t *fcport;
ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
atomic_set(&vha->loop_state, LOOP_DOWN); atomic_set(&vha->loop_state, LOOP_DOWN);
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
list_for_each_entry(fcport, &vha->vp_fcports, list)
fcport->logout_on_delete = 0;
qla2x00_mark_all_devices_lost(vha, 0);
/* Remove port id from vp target map */ /* Remove port id from vp target map */
spin_lock_irqsave(&vha->hw->hardware_lock, flags); spin_lock_irqsave(&vha->hw->hardware_lock, flags);
......
...@@ -1147,7 +1147,7 @@ static inline int test_fcport_count(scsi_qla_host_t *vha) ...@@ -1147,7 +1147,7 @@ static inline int test_fcport_count(scsi_qla_host_t *vha)
* qla2x00_wait_for_sess_deletion can only be called from remove_one. * qla2x00_wait_for_sess_deletion can only be called from remove_one.
* it has dependency on UNLOADING flag to stop device discovery * it has dependency on UNLOADING flag to stop device discovery
*/ */
static void void
qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha) qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
{ {
qla2x00_mark_all_devices_lost(vha, 0); qla2x00_mark_all_devices_lost(vha, 0);
......
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