[SCSI] qla2xxx: Correct rport/fcport visibility-state handling during loop-resync.

There were several issues here, one, during RSCN handling if a
follow-on RSCN occurred (within interrupt context) the DPC thread
could inadvertantly leave the fcport in a stale lost state.
Secondly, scheduled rport removal is handled exclusively by the
'parent' DPC thread, so wake up the proper thread. Finally,
process vport loop-resync's only when the vport has in an
"active" state (ID acquired).

Signed-off-by: Seokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Seokmann Ju and committed by
James Bottomley
5de1f70f da57bf8f

+8 -4
+3 -1
drivers/scsi/qla2xxx/qla_init.c
··· 2012 2012 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) { 2013 2013 if (test_bit(LOCAL_LOOP_UPDATE, &save_flags)) 2014 2014 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); 2015 - if (test_bit(RSCN_UPDATE, &save_flags)) 2015 + if (test_bit(RSCN_UPDATE, &save_flags)) { 2016 + ha->flags.rscn_queue_overflow = 1; 2016 2017 set_bit(RSCN_UPDATE, &ha->dpc_flags); 2018 + } 2017 2019 } 2018 2020 2019 2021 return (rval);
+2 -1
drivers/scsi/qla2xxx/qla_mid.c
··· 277 277 clear_bit(RESET_ACTIVE, &vha->dpc_flags); 278 278 } 279 279 280 - if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { 280 + if (atomic_read(&vha->vp_state) == VP_ACTIVE && 281 + test_and_clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { 281 282 if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags))) { 282 283 qla2x00_loop_resync(vha); 283 284 clear_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags);
+3 -2
drivers/scsi/qla2xxx/qla_os.c
··· 1849 1849 int defer) 1850 1850 { 1851 1851 struct fc_rport *rport; 1852 + scsi_qla_host_t *pha = to_qla_parent(ha); 1852 1853 1853 1854 if (!fcport->rport) 1854 1855 return; ··· 1859 1858 spin_lock_irq(ha->host->host_lock); 1860 1859 fcport->drport = rport; 1861 1860 spin_unlock_irq(ha->host->host_lock); 1862 - set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); 1863 - qla2xxx_wake_dpc(ha); 1861 + set_bit(FCPORT_UPDATE_NEEDED, &pha->dpc_flags); 1862 + qla2xxx_wake_dpc(pha); 1864 1863 } else 1865 1864 fc_remote_port_delete(rport); 1866 1865 }