Bug 1226311

Summary: udev don't probe for FS on nbd devices
Product: [Fedora] Fedora Reporter: Karel Zak <kzak>
Component: systemdAssignee: systemd-maint
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: johannbg, jsynacek, lnykryn, msekleta, s, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-17 23:05:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Zak 2015-05-29 12:19:23 UTC
Description of problem:

# modprobe nbd max_part=16
# qemu-nbd -c /dev/nbd0 f23.qcow2 

# lsblk --fs /dev/nbd0
NAME     FSTYPE LABEL UUID MOUNTPOINT
nbd0                       
├─nbd0p1                   
├─nbd0p2                   
└─nbd0p3                   

the problem is that udev db does not contain ID_FS_* data for the partitions, but blkid is able to detect filesytems on the device, for example:

# blkid -p /dev/nbd0p1 -o udev
ID_FS_UUID=06b7c95e-edd0-4bf8-9053-6c8c04a4ceb2
ID_FS_UUID_ENC=06b7c95e-edd0-4bf8-9053-6c8c04a4ceb2
ID_FS_VERSION=1.0
ID_FS_TYPE=ext2
ID_FS_USAGE=filesystem
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_UUID=c6c18c62-01
ID_PART_ENTRY_TYPE=0x83
ID_PART_ENTRY_FLAGS=0x80
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=2048
ID_PART_ENTRY_SIZE=409600
ID_PART_ENTRY_DISK=43:0


How reproducible:

udev during qemu-ndb --connect:

# udevadm monitor 
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[86215.879813] change   /devices/virtual/block/nbd0 (block)
KERNEL[86215.879858] add      /devices/virtual/block/nbd0/nbd0p1 (block)
KERNEL[86215.879902] add      /devices/virtual/block/nbd0/nbd0p2 (block)
KERNEL[86215.879937] add      /devices/virtual/block/nbd0/nbd0p3 (block)
UDEV  [86215.881516] change   /devices/virtual/block/nbd0 (block)
UDEV  [86215.882053] add      /devices/virtual/block/nbd0/nbd0p1 (block)
UDEV  [86215.882375] add      /devices/virtual/block/nbd0/nbd0p2 (block)
UDEV  [86215.882433] add      /devices/virtual/block/nbd0/nbd0p3 (block)


Additional info:

I guess the problem is logic around nbd in /usr/lib/udev/rules.d/99-systemd.rules:

# Ignore nbd devices in the "add" event, with "change" the nbd is ready
ACTION=="add", SUBSYSTEM=="block", KERNEL=="nbd*", ENV{SYSTEMD_READY}="0"

from the monitor it seems that the partitions are added by ADD event, maybe
the rule should be more careful and don't ignore partition...

Comment 1 Zbigniew Jędrzejewski-Szmek 2015-05-29 16:54:40 UTC
Does it work if copy the file to /etc/udev/rules.d/99-systemd.rules and change
 KERNEL=="nbd*" to KERNEL=="nbd*", KERNEL!="nbd*p*" ?

Comment 2 Lennart Poettering 2015-06-09 13:39:06 UTC
Maybe nbd just needs to be added to the new whitelisting in rules/60-persistent-storage.rules ? This used to be blacklisting, but we recently turned this around...

Comment 3 Zbigniew Jędrzejewski-Szmek 2015-06-11 19:16:56 UTC
https://github.com/systemd/systemd/pull/174

Comment 4 Lennart Poettering 2015-06-17 23:05:53 UTC
Closing, see upstream ticket.