Re: nvme-cli ‘nvme connect’ --duplicate-connect flag (-D) is not supported anymore

Nilay Shroff nilay at linux.ibm.com
Wed Apr 3 05:37:29 PDT 2024



On 4/3/24 16:02, Engel, Amit wrote:
> Hello,
> 
> It seems like nvme-cli ‘nvme connect’ --duplicate-connect flag (-D) is not supported anymore
> nvme-cli version 1.16 ‘nvme connect’ -D flag allows duplicate connections between same transport host and subsystem port
> However, when trying to use nvme-cli 2.4 version, we get ‘already connected’ error:
> nvme connect -t tcp -a <ip_address> -s 4420 -n <subsystem_nqn> -D
> already connected
> 
> I can’t find a reason to remove this support. any idea? Is that by mistake?
> 
I think this is a bug in nvme-cli. If you write nvmf-connect options 
directly to /dev/nvme-fabrics then it would work. The fabrics driver code 
would allow a host to create duplicate connections to the same target. 

You may try this directly by-passing nvme-cli:
# echo "nqn=<subsystem_nqn>,transport=tcp,traddr=<ip_address>,trsvcid=4420,duplicate_connect" > /dev/nvme-fabrics

If you want to use nvme-cli then you may try this patch:

--- a/fabrics.c
+++ b/fabrics.c
@@ -999,7 +999,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
        };
 
        c = lookup_ctrl(h, &trcfg);
-       if (c && nvme_ctrl_get_name(c)) {
+       if (c && nvme_ctrl_get_name(c) && !cfg.duplicate_connect) {
                fprintf(stderr, "already connected\n");
                errno = EALREADY;
                goto out_free;

Thanks,
--Nilay 



More information about the Linux-nvme mailing list