• Roman Bolshakov's avatar
    scsi: qla2xxx: Keep initiator ports after RSCN · 632f24f0
    Roman Bolshakov authored
    The driver performs SCR (state change registration) in all modes including
    pure target mode.
    
    For each RSCN, scan_needed flag is set in qla2x00_handle_rscn() for the
    port mentioned in the RSCN and fabric rescan is scheduled. During the
    rescan, GNN_FT handler, qla24xx_async_gnnft_done() deletes session of the
    port that caused the RSCN.
    
    In target mode, the session deletion has an impact on ATIO handler,
    qlt_24xx_atio_pkt(). Target responds with SAM STATUS BUSY to I/O incoming
    from the deleted session. qlt_handle_cmd_for_atio() and
    qlt_handle_task_mgmt() return -EFAULT if they are not able to find session
    of the command/TMF, and that results in invocation of qlt_send_busy():
    
      qlt_24xx_atio_pkt_all_vps: qla_target(0): type 6 ox_id 0014
      qla_target(0): Unable to send command to target, sending BUSY status
    
    Such response causes command timeout on the initiator. Error handler thread
    on the initiator will be spawned to abort the commands:
    
      scsi 23:0:0:0: tag#0 abort scheduled
      scsi 23:0:0:0: tag#0 aborting command
      qla2xxx [0000:af:00.0]-188c:23: Entered qla24xx_abort_command.
      qla2xxx [0000:af:00.0]-801c:23: Abort command issued nexus=23:0:0 -- 0 2003.
    
    Command abort is rejected by target and fails (2003), error handler then
    tries to perform DEVICE RESET and TARGET RESET but they're also doomed to
    fail because TMFs are ignored for the deleted sessions.
    
    Then initiator makes BUS RESET that resets the link via
    qla2x00_full_login_lip(). BUS RESET succeeds and brings initiator port up,
    SAN switch detects that and sends RSCN to the target port and it fails
    again the same way as described above. It never goes out of the loop.
    
    The change breaks the RSCN loop by keeping initiator sessions mentioned in
    RSCN payload in all modes, including dual and pure target mode.
    
    Link: https://lore.kernel.org/r/20200605144435.27023-1-r.bolshakov@yadro.com
    Fixes: 2037ce49 ("scsi: qla2xxx: Fix stale session")
    Cc: Quinn Tran <qutran@marvell.com>
    Cc: Arun Easi <aeasi@marvell.com>
    Cc: Nilesh Javali <njavali@marvell.com>
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: Daniel Wagner <dwagner@suse.de>
    Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
    Cc: Martin Wilck <mwilck@suse.com>
    Cc: stable@vger.kernel.org # v5.4+
    Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
    Reviewed-by: default avatarShyam Sundar <ssundar@marvell.com>
    Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    632f24f0
qla_gs.c 118 KB