scsi: qla2xxx: Fix NPIV deletion by calling wait_for_sess_deletion
authorQuinn Tran <quinn.tran@cavium.com>
Wed, 18 Jul 2018 21:29:52 +0000 (14:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Aug 2018 10:16:37 +0000 (12:16 +0200)
commit efa93f48fa9d423fda166bc3b6c0cbb09682492e upstream.

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

Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c

index 9ce28c4f9812b6a4890fd909ae3fec8f6b39bd0c..b09d29931393265ce4989cd5b35b30a98326aa2d 100644 (file)
@@ -2142,6 +2142,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
                msleep(1000);
 
        qla24xx_disable_vp(vha);
+       qla2x00_wait_for_sess_deletion(vha);
 
        vha->flags.delete_progress = 1;
 
index f852ca60c49fd182192efaeb6853bf5c379f015c..89706341514e29b57ef94f8b96c27fcd6e556bd9 100644 (file)
@@ -200,6 +200,7 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,
        uint16_t *);
 int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *);
 int qla24xx_async_abort_cmd(srb_t *);
+void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *);
 
 /*
  * Global Functions in qla_mid.c source file.
index d77dde89118e3ff0e1a6e1e0b18a02743a98d5dd..375a88e18afe6a0c910822bc233b02265e60dc83 100644 (file)
@@ -152,10 +152,15 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
 {
        unsigned long flags;
        int ret;
+       fc_port_t *fcport;
 
        ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
        atomic_set(&vha->loop_state, LOOP_DOWN);
        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 */
        spin_lock_irqsave(&vha->hw->vport_slock, flags);
index 1be76695e6924331e7e16b57137de694eef3caae..6dbc2ab9090b369d584f1ba00e1b5bb08d17ed30 100644 (file)
@@ -1136,7 +1136,7 @@ static inline int test_fcport_count(scsi_qla_host_t *vha)
  * qla2x00_wait_for_sess_deletion can only be called from remove_one.
  * it has dependency on UNLOADING flag to stop device discovery
  */
-static void
+void
 qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
 {
        qla2x00_mark_all_devices_lost(vha, 0);