Skip to content
  • Dmitry Bogdanov's avatar
    scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal · 2ef7665d
    Dmitry Bogdanov authored
    Target de-configuration panics at high CPU load because TPGT and WWPN can
    be removed on separate threads.
    
    TPGT removal requests a reset HBA on a separate thread and waits for reset
    complete (phase1). Due to high CPU load that HBA reset can be delayed for
    some time.
    
    WWPN removal does qlt_stop_phase2(). There it is believed that phase1 has
    already completed and thus tgt.tgt_ops is subsequently cleared. However,
    tgt.tgt_ops is needed to process incoming traffic and therefore this will
    cause one of the following panics:
    
    NIP qlt_reset+0x7c/0x220 [qla2xxx]
    LR  qlt_reset+0x68/0x220 [qla2xxx]
    Call Trace:
    0xc000003ffff63a78 (unreliable)
    qlt_handle_imm_notify+0x800/0x10c0 [qla2xxx]
    qlt_24xx_atio_pkt+0x208/0x590 [qla2xxx]
    qlt_24xx_process_atio_queue+0x33c/0x7a0 [qla2xxx]
    qla83xx_msix_atio_q+0x54/0x90 [qla2xxx]
    
    or
    
    NIP qlt_24xx_handle_abts+0xd0/0x2a0 [qla2xxx]
    LR  qlt_24xx_handle_abts+0xb4/0x2a0 [qla2xxx]
    Call Trace:
    qlt_24xx_handle_abts+0x90/0x2a0 [qla2xxx] (unreliable)
    qlt_24xx_process_atio_queue+0x500/0x7a0 [qla2xxx]
    qla83xx_msix_atio_q+0x54/0x90 [qla2xxx]
    
    or
    
    NIP qlt_create_sess+0x90/0x4e0 [qla2xxx]
    LR  qla24xx_do_nack_work+0xa8/0x180 [qla2xxx]
    Call Trace:
    0xc0000000348fba30 (unreliable)
    qla24xx_do_nack_work+0xa8/0x180 [qla2xxx]
    qla2x00_do_work+0x674/0xbf0 [qla2xxx]
    qla2x00_iocb_work_fn
    
    The patch fixes the issue by serializing qlt_stop_phase1() and
    qlt_stop_phase2() functions to make WWPN removal wait for phase1
    completion.
    
    Link: https://lore.kernel.org/r/20210415203554.27890-1-d.bogdanov@yadro.com
    
    
    Reviewed-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
    Signed-off-by: default avatarDmitry Bogdanov <d.bogdanov@yadro.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    2ef7665d