* [PATCH] nvme-fc: fail new connections to a deleted host or remote port
@ 2020-09-17 20:33 James Smart
2020-09-18 16:38 ` Himanshu Madhani
2020-09-21 14:45 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2020-09-17 20:33 UTC (permalink / raw)
To: linux-nvme; +Cc: James Smart
[-- Attachment #1.1: Type: text/plain, Size: 1431 bytes --]
The lldd may have made calls to delete a remote port or local port and
the delete is in progress when the cli then attempts to create a new
controller. Currently, this proceeds without error although it can't be
very successful.
Fix this by validating that both the host port and remote port are
present when a new controller is to be created.
Signed-off-by: James Smart <james.smart@broadcom.com>
---
drivers/nvme/host/fc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index bc4e1af587cc..3f9eb37fe779 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3671,12 +3671,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
spin_lock_irqsave(&nvme_fc_lock, flags);
list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
if (lport->localport.node_name != laddr.nn ||
- lport->localport.port_name != laddr.pn)
+ lport->localport.port_name != laddr.pn ||
+ lport->localport.port_state != FC_OBJSTATE_ONLINE)
continue;
list_for_each_entry(rport, &lport->endp_list, endp_list) {
if (rport->remoteport.node_name != raddr.nn ||
- rport->remoteport.port_name != raddr.pn)
+ rport->remoteport.port_name != raddr.pn ||
+ rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
continue;
/* if fail to get reference fall through. Will error */
--
2.26.2
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4163 bytes --]
[-- Attachment #2: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fc: fail new connections to a deleted host or remote port
2020-09-17 20:33 [PATCH] nvme-fc: fail new connections to a deleted host or remote port James Smart
@ 2020-09-18 16:38 ` Himanshu Madhani
2020-09-21 14:45 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2020-09-18 16:38 UTC (permalink / raw)
To: James Smart; +Cc: linux-nvme
> On Sep 17, 2020, at 3:33 PM, James Smart <james.smart@broadcom.com> wrote:
>
> The lldd may have made calls to delete a remote port or local port and
> the delete is in progress when the cli then attempts to create a new
> controller. Currently, this proceeds without error although it can't be
> very successful.
>
> Fix this by validating that both the host port and remote port are
> present when a new controller is to be created.
>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
> drivers/nvme/host/fc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index bc4e1af587cc..3f9eb37fe779 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -3671,12 +3671,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
> spin_lock_irqsave(&nvme_fc_lock, flags);
> list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
> if (lport->localport.node_name != laddr.nn ||
> - lport->localport.port_name != laddr.pn)
> + lport->localport.port_name != laddr.pn ||
> + lport->localport.port_state != FC_OBJSTATE_ONLINE)
> continue;
>
> list_for_each_entry(rport, &lport->endp_list, endp_list) {
> if (rport->remoteport.node_name != raddr.nn ||
> - rport->remoteport.port_name != raddr.pn)
> + rport->remoteport.port_name != raddr.pn ||
> + rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
> continue;
>
> /* if fail to get reference fall through. Will error */
> --
> 2.26.2
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
Looks good.
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fc: fail new connections to a deleted host or remote port
2020-09-17 20:33 [PATCH] nvme-fc: fail new connections to a deleted host or remote port James Smart
2020-09-18 16:38 ` Himanshu Madhani
@ 2020-09-21 14:45 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-09-21 14:45 UTC (permalink / raw)
To: James Smart; +Cc: linux-nvme
Thanks,
applied to nvme-5.9.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-21 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 20:33 [PATCH] nvme-fc: fail new connections to a deleted host or remote port James Smart
2020-09-18 16:38 ` Himanshu Madhani
2020-09-21 14:45 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.