• James Smart's avatar
    scsi: lpfc: Coordinate adapter error handling with offline handling · 4645f7b5
    James Smart authored
    The driver periodically checks for adapter error in a background thread. If
    the thread detects an error, the adapter will be reset including the
    deletion and reallocation of workqueues on the adapter.  Simultaneously,
    there may be a user-space request to offline the adapter which may try to
    do many of the same steps, in parallel, on a different thread. As memory
    was deallocated while unexpected, the parallel offline request hit a bad
    pointer.
    
    Add coordination between the two threads.  The error recovery thread has
    precedence. So, when an error is detected, a flag is set on the adapter to
    indicate the error thread is terminating the adapter. But, before doing
    that work, it will look for a flag that is set by the offline flow, and if
    set, will wait for it to complete before then processing the error handling
    path.  Similarly, in the offline thread, it first checks for whether the
    error thread is resetting the adapter, and if so, will then wait for the
    error thread to finish. Only after it has finished, will it set its flag
    and offline the adapter.
    Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    4645f7b5
lpfc_sli.h 16 KB