Comment 4 for bug 1830913

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Ryan,

Got the needed output, it looks like the namespace block device created on a virtual NVMe subsystem has ID_SERIAL and ID_SERIAL_SHORT referring to a particular controller:

$ readlink /sys/block/nvme0*
../devices/pci0000:80/0000:80:01.0/0000:81:00.0/nvme/nvme0/nvme0c33n1
../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
ubuntu@node-7:~$ udevadm info -q all -n /dev/nvme0n1
P: /devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
N: nvme0n1
S: disk/by-dname/nvme0n1
S: disk/by-id/nvme-Dell_Express_Flash_PM1725b_1.6TB_AIC_S47ANE0M300982
S: disk/by-id/nvme-eui.343741304d3009820025384500000004
E: DEVLINKS=/dev/disk/by-id/nvme-Dell_Express_Flash_PM1725b_1.6TB_AIC_S47ANE0M300982 /dev/disk/by-dname/nvme0n1 /dev/disk/by-id/nvme-eui.343741304d3009820025384500000004
E: DEVNAME=/dev/nvme0n1
E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
E: DEVTYPE=disk
E: ID_MODEL=Dell Express Flash PM1725b 1.6TB AIC
E: ID_SERIAL=Dell Express Flash PM1725b 1.6TB AIC_S47ANE0M300982
E: ID_SERIAL_SHORT=S47ANE0M300982
E: ID_WWN=eui.343741304d3009820025384500000004
E: MAJOR=259
E: MINOR=1
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=8800965

I don't have an NVMeOF setup to verify this but from what I understand a namespace can be discovered via one of multiple controllers and, therefore, may get different a ID_SERIAL or ID_SERIAL_SHORT content in a uevent. So there is a chance that the by-dname udev rule will be affected by the order of discovery of namespaces (i.e. a symlink will only be created if a namespace is discovered through the same controller that was used during commissioning).

If we matched only against ID_WWN then we would not care about the controller through which a namespace has been discovered.

> OK. I would be surprised if the udev info contained hidden values

What I meant was that both of the namespace-related entries are present in sysfs:

/sys/block/nvme0c33n1
/sys/block/nvme0n1

But only one entry is present in devtmpfs because GENHD_FL_HIDDEN flag is applied to a controller-specific gendisk in the kernel:

/dev/nvme0n1