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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Feb 2022 11:03:02 +0000 (12:03 +0100)
commit06bd0f157e70b6c3f5639e5ac97dc6720699e2a7
tree56eebba8eae106eb75ffb2274e0e576e42eb58dd
parentae6ca6343929a00ef95c7c8d1bea47d651785edc
scsi: lpfc: Fix mailbox command failure during driver initialization

commit efe1dc571a5b808baa26682eef16561be2e356fd upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/lpfc/lpfc_sli.c