]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: qla2xxx: Fix race condition for resource cleanup
authorQuinn Tran <quinn.tran@cavium.com>
Tue, 11 Sep 2018 17:18:17 +0000 (10:18 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Sep 2018 00:28:09 +0000 (20:28 -0400)
For Loop topology + Initiator, FW is in control of PLOGI/PRLI.  When link is
reset, driver will try to cleanup the session by doing an Implicit Logout.
Instead, the code is doing an Explicit Logout.  The explicit logout interferes
with FW state machine in trying to reconnect.  The implicit logout was meant
for FW to flush commands.  In loop, it is not needed because FW will auto
flush.

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>
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_iocb.c

index 4d04603dd4aea53c413c0b471d0ac0988e40ab33..6f6739b945ea535cf9cee7aad1f4c250733f17a2 100644 (file)
@@ -4991,6 +4991,19 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
            (uint8_t *)ha->gid_list,
            entries * sizeof(struct gid_list_info));
 
+       if (entries == 0) {
+               spin_lock_irqsave(&vha->work_lock, flags);
+               vha->scan.scan_retry++;
+               spin_unlock_irqrestore(&vha->work_lock, flags);
+
+               if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
+                       set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
+                       set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
+               }
+       } else {
+               vha->scan.scan_retry = 0;
+       }
+
        list_for_each_entry(fcport, &vha->vp_fcports, list) {
                fcport->scan_state = QLA_FCPORT_SCAN;
        }
index 6335b8ce5fbdaa7cb982d497830665f59f71d4c9..4de910231ba60e83a61168b619e4b83ce4ae4410 100644 (file)
@@ -2270,8 +2270,7 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
        logio->entry_type = LOGINOUT_PORT_IOCB_TYPE;
        logio->control_flags =
            cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
-       if (!sp->fcport->se_sess ||
-           !sp->fcport->keep_nport_handle)
+       if (!sp->fcport->keep_nport_handle)
                logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
        logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
        logio->port_id[0] = sp->fcport->d_id.b.al_pa;