• James Smart's avatar
    scsi: lpfc: Fix nvme remoteport registration race conditions · b15bd3e6
    James Smart authored
    On tests adding and removing a remote port, calls to nvme_info would
    eventually show fewer target ports discovered than were present in the
    san. Additionally, the following error messages were seen:
    
      6031 RemotePort Registration failed err: -116, DID x471301
    
    There is a race condition that exists between the driver and the nvme
    transport on remote port unregister vs the confirmed deletion. It's
    possible that the driver may rediscover the remote port and reregister
    the remote port before a prior unregister delete callback was made (as
    it rebinded to the prior remoteport structure). However, the driver was
    coded to expect the callback before seeing the remote port again thus a
    new registration. The logic results in the driver having an invalid
    remoteport pointer set.
    
    Correct by tracking when waiting for the delete callback. In cases where
    the ndlp remoteport pointer is updated, it is only cleared when the wait
    has not been superceded by a prior registration.
    Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
    Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    b15bd3e6
lpfc_nvme.c 89.5 KB