[PATCH v2] nvme: consider also host_iface when checking ip options
Daniel Wagner
dwagner at suse.de
Fri Jul 22 02:24:56 PDT 2022
It's perfectly fine to use the same traddr and trsvcid more than once
as long we use different a host_iface. This is used in setups where
the host has more than one interface but the target exposes only one
IP.
To keep the match logic simple don't allow mixed setups. The user
needs to use host_iface option consistently for all controllers in
such setups.
Signed-off-by: Daniel Wagner <dwagner at suse.de>
---
leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420
leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420
Failed to write to /dev/nvme-fabrics: Operation already in progress
no controller found: failed to write to nvme-fabrics device
leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth1
Failed to write to /dev/nvme-fabrics: Operation already in progress
no controller found: failed to write to nvme-fabrics device
leap154:~ # nvme disconnect -n nvmet-test
NQN:nvmet-test disconnected 1 controller(s)
leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth0
leap154:~ # nvme connect -t tcp -n nvmet-test -a 192.168.19.54 -s 4420 -f eth1
drivers/nvme/host/fabrics.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 604ab0e5a2ad..dc12853d04c9 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -944,7 +944,10 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl,
{
if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
strcmp(opts->traddr, ctrl->opts->traddr) ||
- strcmp(opts->trsvcid, ctrl->opts->trsvcid))
+ strcmp(opts->trsvcid, ctrl->opts->trsvcid) ||
+ (((opts->mask & NVMF_OPT_HOST_IFACE) &&
+ (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) &&
+ strcmp(opts->host_iface, ctrl->opts->host_iface)))
return false;
/*
--
2.37.1
More information about the Linux-nvme
mailing list