All of lore.kernel.org
 help / color / mirror / Atom feed
* /dev/mapper/<dm_name> symlink not being created
@ 2012-04-30 12:08 Nicholas Nevin
  2012-05-12 14:59 ` Nicholas Nevin
  0 siblings, 1 reply; 6+ messages in thread
From: Nicholas Nevin @ 2012-04-30 12:08 UTC (permalink / raw)
  To: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 1638 bytes --]

In nightly testing of our product the tests do a fair bit of
creating/destroying of device mapper devices and we have been seeing
infrequent cases where the device is created OK but the corresponding
/dev/mapper/<dm_name> symlink does not exist.

Here is an example of the dmsetup command used to create the devices.

# dmsetup create tap0 --table '0 47247164 linear /dev/xen/blktap-2/tapdev0
1'

I managed to reproduce this problem with udev logging enabled and 'udevadm
monitor' running and from the logs the cause appears to be that the udev
add action (from the device create) and the udev change action (from when
the device is resumed after loading the table) are running
concurrently. The processing of the rules for the change action creates the
/dev/mapper/tap0 symlink but then the processing of the add action deletes
the symlink because /dev/mapper/tap0 is not in the add action DEVLINKS.

The question I have is should dmsetup be ensuring that the add action
completes before the change action is handled or is this behaviour expected?

That /dev/mapper/tap0 is not in the DEVLINKS for the add action is AFAICT
because of a race between the creation of the sysfs entries for the device
and the processing of the add action in udevd. This can be fixed by
sprinkling in some WAIT_FOR conditions in the dm udev rules. Our system is
based on Ubuntu 12.04.

I have attached the udevadm monitor output and the relevant piece of syslog
for a test case where the /dev/mapper/tap0 symlink wasn't present when
dmsetup returned.

I hope this is the right place to ask this. If not please point me in the
right direction.

Thanks, Nick.

[-- Attachment #1.2: Type: text/html, Size: 1902 bytes --]

[-- Attachment #2: syslog --]
[-- Type: application/octet-stream, Size: 7993 bytes --]

Apr 27 18:53:46 HP6535B udevd[410]: seq 80951 queued, 'add' 'bdi' 
Apr 27 18:53:46 HP6535B udevd[410]: passed 153 bytes to netlink monitor 0x7ff22301f2d0 
Apr 27 18:53:46 HP6535B udevd[1486]: seq 80951 running 
Apr 27 18:53:46 HP6535B udevd[1486]: device 0x7ff22302dc10 has devpath '/devices/virtual/bdi/251:7' 
Apr 27 18:53:46 HP6535B udevd[410]: seq 80952 queued, 'add' 'block' 
Apr 27 18:53:46 HP6535B udevd[410]: passed 200 bytes to netlink monitor 0x7ff22301f2d0 
Apr 27 18:53:46 HP6535B udevd[1486]: no db file to read /run/udev/data/+bdi:251:7: No such file or directory 
Apr 27 18:53:46 HP6535B udevd[1556]: seq 80952 running 
Apr 27 18:53:46 HP6535B udevd[1556]: device 0x7ff22302d130 has devpath '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: passed -1 bytes to netlink monitor 0x7ff22302f030 
Apr 27 18:53:46 HP6535B udevd[1486]: seq 80951 processed with 0 
Apr 27 18:53:46 HP6535B udevd[1556]: device 0x7ff22302d130 filled with db file data 
Apr 27 18:53:46 HP6535B udevd[1556]: GROUP 6 /lib/udev/rules.d/50-udev-default.rules:67 
Apr 27 18:53:46 HP6535B udevd[1556]: IMPORT '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o name,uuid,suspended' /lib/udev/rules.d/55-dm.rules:69 
Apr 27 18:53:46 HP6535B udevd[410]: seq 80951 done with 0 
Apr 27 18:53:46 HP6535B udevd[8755]: starting '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o name,uuid,suspended' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o name,uuid,suspended'(err) 'Device does not exist.' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o name,uuid,suspended'(err) 'Command failed' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o name,uuid,suspended' [8755] exit with return code 1 
Apr 27 18:53:46 HP6535B udevd[1556]: IMPORT '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o suspended' /lib/udev/rules.d/55-dm.rules:70 
Apr 27 18:53:46 HP6535B udevd[8757]: starting '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o suspended' 
Apr 27 18:53:46 HP6535B udevd[410]: seq 80953 queued, 'change' 'block' 
Apr 27 18:53:46 HP6535B udevd[1486]: seq 80953 running 
Apr 27 18:53:46 HP6535B udevd[1486]: device 0x7ff22302eac0 has devpath '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: device 0x7ff22302eac0 filled with db file data 
Apr 27 18:53:46 HP6535B udevd[1486]: GROUP 6 /lib/udev/rules.d/50-udev-default.rules:67 
Apr 27 18:53:46 HP6535B udevd[1486]: IMPORT '/sbin/dmsetup udevflags 4223486' /lib/udev/rules.d/55-dm.rules:20 
Apr 27 18:53:46 HP6535B udevd[410]: passed 221 bytes to netlink monitor 0x7ff22301f2d0 
Apr 27 18:53:46 HP6535B udevd[8758]: starting '/sbin/dmsetup udevflags 4223486' 
Apr 27 18:53:46 HP6535B udevd[1486]: '/sbin/dmsetup udevflags 4223486'(out) 'DM_UDEV_PRIMARY_SOURCE_FLAG='1'' 
Apr 27 18:53:46 HP6535B udevd[1486]: '/sbin/dmsetup udevflags 4223486' [8758] exit with return code 0 
Apr 27 18:53:46 HP6535B udevd[1486]: RUN '/sbin/dmsetup udevcomplete $env{DM_COOKIE}' /lib/udev/rules.d/55-dm.rules:21 
Apr 27 18:53:46 HP6535B udevd[1486]: LINK 'mapper/tap1' /lib/udev/rules.d/55-dm.rules:80 
Apr 27 18:53:46 HP6535B udevd[1486]: LINK 'disk/by-id/dm-name-tap1' /etc/udev/rules.d/60-persistent-storage-dm.rules:9 
Apr 27 18:53:46 HP6535B udevd[1486]: IMPORT '/sbin/blkid -o udev -p /dev/dm-7' /etc/udev/rules.d/60-persistent-storage-dm.rules:18 
Apr 27 18:53:46 HP6535B udevd[8759]: starting '/sbin/blkid -o udev -p /dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o suspended'(out) 'DM_SUSPENDED='Active'' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/dmsetup info -j 251 -m 7 -c --nameprefixes --noheadings --rows -o suspended' [8757] exit with return code 0 
Apr 27 18:53:46 HP6535B udevd[1556]: LINK 'disk/by-id/dm-name-' /etc/udev/rules.d/60-persistent-storage-dm.rules:9 
Apr 27 18:53:46 HP6535B udevd[1556]: IMPORT '/sbin/blkid -o udev -p /dev/dm-7' /etc/udev/rules.d/60-persistent-storage-dm.rules:18 
Apr 27 18:53:46 HP6535B udevd[8760]: starting '/sbin/blkid -o udev -p /dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: '/sbin/blkid -o udev -p /dev/dm-7' [8759] exit with return code 2 
Apr 27 18:53:46 HP6535B udevd[1486]: no node name set, will use kernel supplied name 'dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: creating device node '/dev/dm-7', devnum=251:7, mode=0660, uid=0, gid=6 
Apr 27 18:53:46 HP6535B udevd[1486]: preserve file '/dev/dm-7', because it has correct dev_t 
Apr 27 18:53:46 HP6535B udevd[1486]: set permissions /dev/dm-7, 060660, uid=0, gid=6 
Apr 27 18:53:46 HP6535B udevd[1486]: creating symlink '/dev/block/251:7' to '../dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: creating link '/dev/disk/by-id/dm-name-tap1' to '/dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: creating symlink '/dev/disk/by-id/dm-name-tap1' to '../../dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: creating link '/dev/mapper/tap1' to '/dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: creating symlink '/dev/mapper/tap1' to '../dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: created db file '/run/udev/data/b251:7' for '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[8761]: starting '/sbin/dmsetup udevcomplete 4223486' 
Apr 27 18:53:46 HP6535B udevd[1556]: '/sbin/blkid -o udev -p /dev/dm-7' [8760] exit with return code 2 
Apr 27 18:53:46 HP6535B udevd[1556]: no node name set, will use kernel supplied name 'dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: update old name, '/dev/disk/by-id/dm-name-tap1' no longer belonging to '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: no reference left, remove '/dev/disk/by-id/dm-name-tap1' 
Apr 27 18:53:46 HP6535B udevd[1556]: update old name, '/dev/mapper/tap1' no longer belonging to '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: no reference left, remove '/dev/mapper/tap1' 
Apr 27 18:53:46 HP6535B udevd[1556]: creating device node '/dev/dm-7', devnum=251:7, mode=0660, uid=0, gid=6 
Apr 27 18:53:46 HP6535B udevd[1556]: preserve file '/dev/dm-7', because it has correct dev_t 
Apr 27 18:53:46 HP6535B udevd[1556]: preserve permissions /dev/dm-7, 060660, uid=0, gid=6 
Apr 27 18:53:46 HP6535B udevd[1556]: preserve already existing symlink '/dev/block/251:7' to '../dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: found 'b251:7' claiming '/run/udev/links/disk\x2fby-id\x2fdm-name-' 
Apr 27 18:53:46 HP6535B udevd[1556]: found 'b251:8' claiming '/run/udev/links/disk\x2fby-id\x2fdm-name-' 
Apr 27 18:53:46 HP6535B udevd[1556]: found 'b251:9' claiming '/run/udev/links/disk\x2fby-id\x2fdm-name-' 
Apr 27 18:53:46 HP6535B udevd[1556]: creating link '/dev/disk/by-id/dm-name-' to '/dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: preserve already existing symlink '/dev/disk/by-id/dm-name-' to '../../dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: created db file '/run/udev/data/b251:7' for '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: adding watch on '/dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: created db file '/run/udev/data/b251:7' for '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1556]: passed -1 bytes to netlink monitor 0x7ff22301ffc0 
Apr 27 18:53:46 HP6535B udevd[1556]: seq 80952 processed with 0 
Apr 27 18:53:46 HP6535B udevd[410]: seq 80952 done with 0 
Apr 27 18:53:46 HP6535B udevd[1486]: '/sbin/dmsetup udevcomplete 4223486' [8761] exit with return code 0 
Apr 27 18:53:46 HP6535B udevd[1486]: adding watch on '/dev/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: created db file '/run/udev/data/b251:7' for '/devices/virtual/block/dm-7' 
Apr 27 18:53:46 HP6535B udevd[1486]: passed -1 bytes to netlink monitor 0x7ff22302f030 
Apr 27 18:53:46 HP6535B udevd[1486]: seq 80953 processed with 0 
Apr 27 18:53:46 HP6535B udevd[410]: seq 80953 done with 0 

[-- Attachment #3: monitor.out --]
[-- Type: application/octet-stream, Size: 1488 bytes --]

KERNEL[79669.539249] add      /devices/virtual/bdi/251:7 (bdi)
ACTION=add
DEVPATH=/devices/virtual/bdi/251:7
SEQNUM=80951
SUBSYSTEM=bdi
UDEV_LOG=3

KERNEL[79669.539609] add      /devices/virtual/block/dm-7 (block)
ACTION=add
DEVNAME=dm-7
DEVPATH=/devices/virtual/block/dm-7
DEVTYPE=disk
MAJOR=251
MINOR=7
SEQNUM=80952
SUBSYSTEM=block
UDEV_LOG=3

UDEV  [79669.541404] add      /devices/virtual/bdi/251:7 (bdi)
ACTION=add
DEVPATH=/devices/virtual/bdi/251:7
SEQNUM=80951
SUBSYSTEM=bdi
UDEV_LOG=7
USEC_INITIALIZED=79669540071

KERNEL[79669.548290] change   /devices/virtual/block/dm-7 (block)
ACTION=change
DEVNAME=dm-7
DEVPATH=/devices/virtual/block/dm-7
DEVTYPE=disk
DM_COOKIE=4223486
MAJOR=251
MINOR=7
SEQNUM=80953
SUBSYSTEM=block
UDEV_LOG=3

UDEV  [79669.699756] add      /devices/virtual/block/dm-7 (block)
ACTION=add
DEVLINKS=/dev/disk/by-id/dm-name-
DEVNAME=/dev/dm-7
DEVPATH=/devices/virtual/block/dm-7
DEVTYPE=disk
DM_SUSPENDED=0
DM_UDEV_RULES=1
MAJOR=251
MINOR=7
SEQNUM=80952
SUBSYSTEM=block
UDEV_LOG=7
USEC_INITIALIZED=1092997836

UDEV  [79669.701727] change   /devices/virtual/block/dm-7 (block)
ACTION=change
DEVLINKS=/dev/disk/by-id/dm-name-tap1 /dev/mapper/tap1
DEVNAME=/dev/dm-7
DEVPATH=/devices/virtual/block/dm-7
DEVTYPE=disk
DM_COOKIE=4223486
DM_NAME=tap1
DM_SUSPENDED=0
DM_UDEV_PRIMARY_SOURCE_FLAG=1
DM_UDEV_RULES=1
MAJOR=251
MINOR=7
SEQNUM=80953
SUBSYSTEM=block
UDEV_LOG=7
USEC_INITIALIZED=1092997836

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2012-05-15 14:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-30 12:08 /dev/mapper/<dm_name> symlink not being created Nicholas Nevin
2012-05-12 14:59 ` Nicholas Nevin
2012-05-14 13:43   ` Zdenek Kabelac
2012-05-15 13:55     ` Nicholas Nevin
2012-05-15 14:07       ` Alasdair G Kergon
2012-05-15 14:32         ` Nicholas Nevin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.