public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] nvme-fabrics: fix un-expected behaviour related to hostnqn and hostid
@ 2023-05-10 18:02 Max Gurtovoy
  2023-05-10 18:02 ` [PATCH 1/3] nvme-fabrics: unify common code in admin and io queue connect Max Gurtovoy
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Max Gurtovoy @ 2023-05-10 18:02 UTC (permalink / raw)
  To: hch, sagi, kbusch, linux-nvme
  Cc: hare, axboe, oren, ngottlieb, israelr, Max Gurtovoy

Hi Christoph/Sagi/Keith,
I've noticed that we are having some un-expected behaviour in some of
the scenarios of connection establisment related to hostnqn and hostid.
This is specially around overriding hostid for a host.

For example:
-------------
1. Connect to a target with default hostnqn and hostid (after removing
the files from /etc/nvme):
    - # nvme connect -t tcp -n testsubsystem_0 -a 1.1.1.1 -s 4420
2. Check hostnqn and hostid
    - #cat /sys/class/nvme/nvme0/host*
       1791bca2-af3c-4e17-a310-6fbdde3b59cb
       nqn.2014-08.org.nvmexpress:uuid:fc4e5383-ce5c-470d-9889-4adbc2dbe969
3. Connect to a target with given hostid from cmdline:
    - # nvme connect -t tcp -n testsubsystem_0 -a 1.1.1.1 -s 4420 -I 77720af2-ce59-418b-82ff-7c9df0cea35e
        Failed to write to /dev/nvme-fabrics: Operation already in progress <--- failed on duplicate connection check
4. Check hostnqn and hostid of first controller
    - #cat /sys/class/nvme/nvme0/host*
       77720af2-ce59-418b-82ff-7c9df0cea35e <--- hostid was changed !!!!
       nqn.2014-08.org.nvmexpress:uuid:fc4e5383-ce5c-470d-9889-4adbc2dbe969
5. Connect to a target with given hostid from cmdline and allow duplicate connections:
    - # nvme connect -t tcp -n testsubsystem_0 -a 1.1.1.1 -s 4420 -I 77720af2-ce59-418b-82ff-7c9df0cea3bb -D
6. Check hostnqn and hostid of first controller again
    - #cat /sys/class/nvme/nvme0/host*
       77720af2-ce59-418b-82ff-7c9df0cea3bb  <--- hostid was changed again !!!!
       nqn.2014-08.org.nvmexpress:uuid:fc4e5383-ce5c-470d-9889-4adbc2dbe969

This seems like a wrong behaviour to me since in case we try to
reconnect the target will see that a different values after
reconnections and this change the expected behaviour to keep hostid.

According to the spec:

"This feature allows the host to register a Host Identifier with the
controller. The Host Identifier is used by the controller to determine
whether other controllers in the NVM subsystem are associated with the same
host.
"

Also:

"
A host that uses a single Host NQN may employ multiple Host Identifiers
to designate elements of the host
that access an NVM subsystem independently of each other (e.g., physical
or logical partitions of the host)
"

These patchset fixes the current behaviour and allows one to set
different hostIDs for a single hostNQN but not vice versa (as we would
like to enable the target also recognize a logical partition of the
host).

The first 2 patches are some preparations and cleanups and patch 3/3 is
the actual fix.

Max Gurtovoy (3):
  nvme-fabrics: unify common code in admin and io queue connect
  nvme-fabrics: check hostid using uuid_equal
  nvme-fabrics: prevent overriding of existing host

 drivers/nvme/host/fabrics.c | 163 +++++++++++++++++++++++-------------
 drivers/nvme/host/fabrics.h |   3 +-
 2 files changed, 106 insertions(+), 60 deletions(-)

-- 
2.18.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-11 14:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-10 18:02 [PATCH v1 0/3] nvme-fabrics: fix un-expected behaviour related to hostnqn and hostid Max Gurtovoy
2023-05-10 18:02 ` [PATCH 1/3] nvme-fabrics: unify common code in admin and io queue connect Max Gurtovoy
2023-05-11 13:12   ` Christoph Hellwig
2023-05-10 18:02 ` [PATCH 2/3] nvme-fabrics: check hostid using uuid_equal Max Gurtovoy
2023-05-11 13:13   ` Christoph Hellwig
2023-05-11 13:27     ` Max Gurtovoy
2023-05-10 18:02 ` [PATCH 3/3] nvme-fabrics: prevent overriding of existing host Max Gurtovoy
2023-05-11 13:16   ` Christoph Hellwig
2023-05-11 13:26     ` Max Gurtovoy
2023-05-11 13:49       ` Christoph Hellwig
2023-05-11 13:59         ` Max Gurtovoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox