scsi: lpfc: Fix mailbox command failure during driver initialization
authorJames Smart <jsmart2021@gmail.com>
Tue, 21 Sep 2021 14:30:08 +0000 (07:30 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 22 Sep 2021 04:22:12 +0000 (00:22 -0400)
commitefe1dc571a5b808baa26682eef16561be2e356fd
tree9e48c40426b87794c2cd1834ef8aaa42c062990b
parentcbd9a3347c757383f3d2b50cf7cfd03eb479c481
scsi: lpfc: Fix mailbox command failure during driver initialization

Contention for the mailbox interface may occur during driver initialization
(immediately after a function reset), between mailbox commands initiated
via ioctl (bsg) and those driver requested by the driver.

After setting SLI_ACTIVE flag for a port, there is a window in which the
driver will allow an ioctl to be initiated while the adapter is
initializing and issuing mailbox commands via polling. The polling logic
then gets confused.

Correct by having thread setting SLI_ACTIVE spot an active mailbox command
and allow it complete before proceeding.

Link: https://lore.kernel.org/r/20210921143008.64212-1-jsmart2021@gmail.com
Co-developed-by: Nigel Kirkland <nkirkland2304@gmail.com>
Signed-off-by: Nigel Kirkland <nkirkland2304@gmail.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c