Skip to content

Commit 9e0e8da

Browse files
James SmartChristoph Hellwig
authored andcommitted
nvme-fc: fail new connections to a deleted host or remote port
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> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 50b7c24 commit 9e0e8da

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • drivers/nvme/host

drivers/nvme/host/fc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,12 +3671,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
36713671
spin_lock_irqsave(&nvme_fc_lock, flags);
36723672
list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
36733673
if (lport->localport.node_name != laddr.nn ||
3674-
lport->localport.port_name != laddr.pn)
3674+
lport->localport.port_name != laddr.pn ||
3675+
lport->localport.port_state != FC_OBJSTATE_ONLINE)
36753676
continue;
36763677

36773678
list_for_each_entry(rport, &lport->endp_list, endp_list) {
36783679
if (rport->remoteport.node_name != raddr.nn ||
3679-
rport->remoteport.port_name != raddr.pn)
3680+
rport->remoteport.port_name != raddr.pn ||
3681+
rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
36803682
continue;
36813683

36823684
/* if fail to get reference fall through. Will error */

0 commit comments

Comments
 (0)