diff options
author | Dick Kennedy <dick.kennedy@broadcom.com> | 2017-09-30 03:34:30 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-10-03 05:46:34 +0300 |
commit | 2b75d0f93451bc6e11cf9af06e1bf770222c271d (patch) | |
tree | 3d9fde1591dd581c2340d324d073f73188bcb612 /drivers/scsi/lpfc | |
parent | 1234a6d54fed8a00091968c4eb2fb52e1cbb8e2e (diff) | |
download | linux-2b75d0f93451bc6e11cf9af06e1bf770222c271d.tar.xz |
scsi: lpfc: Fix lpfc nvme host rejecting IO with Not Ready message
In a link bounce scenario, a condition can occur where the discovery
engine swaps an ndlp structure (address change for an nport). While the
swap was successfully executed by the discovery engine, the driver did
not properly detect a change in the ndlp bound to the nvme rport. This
error resulted in the nvme host transport issuing an IO to the correct
nvme rport, but the lpfc driver addressed a ndlp with an NLP_UNUSED
status and failed the io. This resulting it it looking like there were
missing namespaces and applications failed due to io errors.
To fix, in lpfc_nvme_register_rport, rework the "rebind" case to break
the nvme rport<->ndlp association when the ndlp already has an
nrport. Then rebind the rport to the correct ndlp data and backpointers.
[mkp: typo]
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nvme.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index d7cb6ba71892..1942e61e1103 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2295,6 +2295,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) struct lpfc_nvme_rport *rport; struct nvme_fc_remote_port *remote_port; struct nvme_fc_port_info rpinfo; + struct lpfc_nodelist *prev_ndlp; lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NVME_DISC, "6006 Register NVME PORT. DID x%06x nlptype x%x\n", @@ -2331,7 +2332,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) * new rport. */ rport = remote_port->private; - if (ndlp->nrport == rport) { + if (ndlp->nrport) { lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NVME_DISC, "6014 Rebinding lport to " @@ -2342,24 +2343,33 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) remote_port->port_role, ndlp->nlp_type, ndlp->nlp_DID); - } else { - /* New rport. */ - rport->remoteport = remote_port; - rport->lport = lport; - rport->ndlp = lpfc_nlp_get(ndlp); - if (!rport->ndlp) - return -1; - ndlp->nrport = rport; - lpfc_printf_vlog(vport, KERN_INFO, - LOG_NVME_DISC | LOG_NODE, - "6022 Binding new rport to " - "lport %p Rport WWNN 0x%llx, " - "Rport WWPN 0x%llx DID " - "x%06x Role x%x\n", - lport, - rpinfo.node_name, rpinfo.port_name, - rpinfo.port_id, rpinfo.port_role); + prev_ndlp = rport->ndlp; + + /* Sever the ndlp<->rport connection before dropping + * the ndlp ref from register. + */ + ndlp->nrport = NULL; + rport->ndlp = NULL; + if (prev_ndlp) + lpfc_nlp_put(ndlp); } + + /* Clean bind the rport to the ndlp. */ + rport->remoteport = remote_port; + rport->lport = lport; + rport->ndlp = lpfc_nlp_get(ndlp); + if (!rport->ndlp) + return -1; + ndlp->nrport = rport; + lpfc_printf_vlog(vport, KERN_INFO, + LOG_NVME_DISC | LOG_NODE, + "6022 Binding new rport to " + "lport %p Rport WWNN 0x%llx, " + "Rport WWPN 0x%llx DID " + "x%06x Role x%x\n", + lport, + rpinfo.node_name, rpinfo.port_name, + rpinfo.port_id, rpinfo.port_role); } else { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC | LOG_NODE, |