• James Smart's avatar
    scsi: lpfc: Correct race with abort on completion path · ca7fb76e
    James Smart authored
    On io completion, the driver is taking an adapter wide lock and nulling the
    scsi command back pointer.  The nulling of the back pointer is to signify the
    io was completed and the scsi_done() routine was called.  However, the routine
    makes no check to see if the abort routine had done the same thing and
    possibly nulled the pointer. Thus it may doubly-complete the io.
    
    Make the following mods:
    
    - Check to make sure forward progress (call scsi_done()) only happens if the
      command pointer was non-null.
    
    - As the taking of the lock, which is adapter wide, is very costly on a system
      under load, null the pointer using an xchg operation rather than under lock.
    Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    ca7fb76e
lpfc_scsi.c 180 KB