diff options
author | James Smart <james.smart@broadcom.com> | 2020-11-15 22:26:32 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-11-17 08:43:54 +0300 |
commit | 95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75 (patch) | |
tree | d6e62807961ab2efcc1376d10f39dc0b76fbc0e6 /drivers/scsi/lpfc/lpfc_vport.c | |
parent | 4430f7fd09ecb037570119e0aacbf0c17b8f98b2 (diff) | |
download | linux-95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75.tar.xz |
scsi: lpfc: Fix removal of SCSI transport device get and put on dev structure
The lpfc driver is calling get_device and put_device on scsi_fc_transport
device structure. When this code was removed, the driver triggered an oops
in "scsi_is_host_dev" when the first SCSI target was unregistered from the
transport.
The reason the calls were necessary is that the driver is calling
scsi_remove_host too early, before the target rports are unregistered and
the scsi devices disconnected from the scsi_host. The fc_host was torn
down during fc_remove_host.
Fix by moving the lpfc_pci_remove_one_s3/s4 calls to scsi_remove_host to
after the nodes are cleaned up. Remove the get_device and put_device calls
and the supporting code.
Link: https://lore.kernel.org/r/20201115192646.12977-4-james.smart@broadcom.com
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_vport.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 6ab78131b94d..0261495b44d3 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -664,9 +664,8 @@ lpfc_vport_delete(struct fc_vport *fc_vport) ns_ndlp_referenced = true; } - /* Remove FC host and then SCSI host with the vport */ + /* Remove FC host to break driver binding. */ fc_remove_host(shost); - scsi_remove_host(shost); ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); @@ -747,6 +746,9 @@ skip_logo: } lpfc_cleanup(vport); + + /* Remove scsi host now. The nodes are cleaned up. */ + scsi_remove_host(shost); lpfc_sli_host_down(vport); lpfc_stop_vport_timers(vport); |