diff options
author | James Smart <james.smart@broadcom.com> | 2020-11-15 11:26:32 -0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-11-17 00:43:54 -0500 |
commit | 95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75 (patch) | |
tree | d6e62807961ab2efcc1376d10f39dc0b76fbc0e6 /drivers/scsi/lpfc/lpfc_hbadisc.c | |
parent | 4430f7fd09ecb037570119e0aacbf0c17b8f98b2 (diff) | |
download | linux-95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75.tar.gz linux-95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75.tar.bz2 linux-95f0ef8a8368b2195ca9b8b4eca9a3ec8d132a75.zip |
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_hbadisc.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 9d387fbf65a3..71ef50c65dcf 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -117,7 +117,6 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) struct lpfc_hba *phba; struct lpfc_work_evt *evtp; int put_node; - int put_rport; unsigned long iflags; rdata = rport->dd_data; @@ -142,13 +141,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) */ if (vport->load_flag & FC_UNLOADING) { put_node = rdata->pnode != NULL; - put_rport = ndlp->rport != NULL; rdata->pnode = NULL; ndlp->rport = NULL; if (put_node) lpfc_nlp_put(ndlp); - if (put_rport) - put_device(&rport->dev); return; } @@ -263,7 +259,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->rport = NULL; if (put_node) lpfc_nlp_put(ndlp); - put_device(&rport->dev); return fcf_inuse; } @@ -284,7 +279,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->rport = NULL; if (put_node) lpfc_nlp_put(ndlp); - put_device(&rport->dev); if (ndlp->nlp_type & NLP_FABRIC) return fcf_inuse; @@ -4190,8 +4184,6 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) lpfc_nlp_put(ndlp); rdata->pnode = NULL; } - /* drop reference for earlier registeration */ - put_device(&rport->dev); } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, @@ -4203,7 +4195,7 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) return; ndlp->rport = rport = fc_remote_port_add(shost, 0, &rport_ids); - if (!rport || !get_device(&rport->dev)) { + if (!rport) { dev_printk(KERN_WARNING, &phba->pcidev->dev, "Warning: fc_remote_port_add failed\n"); return; @@ -4244,6 +4236,7 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) (rport->scsi_target_id < LPFC_MAX_TARGET)) { ndlp->nlp_sid = rport->scsi_target_id; } + return; } @@ -5217,7 +5210,6 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rdata = rport->dd_data; rdata->pnode = NULL; ndlp->rport = NULL; - put_device(&rport->dev); } } |