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:
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:
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* pci0000: 80/0000: 80:01.0/ 0000:81: 00.0/nvme/ nvme0/nvme0c33n 1 virtual/ nvme-subsystem/ nvme-subsys0/ nvme0n1 virtual/ nvme-subsystem/ nvme-subsys0/ nvme0n1 dname/nvme0n1 id/nvme- Dell_Express_ Flash_PM1725b_ 1.6TB_AIC_ S47ANE0M300982 id/nvme- eui.343741304d3 009820025384500 000004 /dev/disk/ by-id/nvme- Dell_Express_ Flash_PM1725b_ 1.6TB_AIC_ S47ANE0M300982 /dev/disk/ by-dname/ nvme0n1 /dev/disk/ by-id/nvme- eui.343741304d3 009820025384500 000004 /dev/nvme0n1 /devices/ virtual/ nvme-subsystem/ nvme-subsys0/ nvme0n1 SHORT=S47ANE0M3 00982 eui.343741304d3 009820025384500 000004 D=8800965
../devices/
../devices/
ubuntu@node-7:~$ udevadm info -q all -n /dev/nvme0n1
P: /devices/
N: nvme0n1
S: disk/by-
S: disk/by-
S: disk/by-
E: DEVLINKS=
E: DEVNAME=
E: DEVPATH=
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_
E: ID_WWN=
E: MAJOR=259
E: MINOR=1
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZE
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