Dec 01 05:07:25.679368 ubuntu systemd-udevd[474]: LINK
'disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869'
/lib/udev/rules.d/60-persistent-storage.rules:79
Dec 01 05:07:25.683008 ubuntu systemd-udevd[474]: WARK:
dev_old_name=/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4
dev_old_path=/devices/virtual/block/bcache0
Dec 01 05:07:25.683042 ubuntu systemd-udevd[474]: WARK:
dev_name=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869
dev_path=/devices/virtual/block/bcache0
Dec 01 05:07:25.683066 ubuntu systemd-udevd[474]: WARK:
streq(name=/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4,
name_current=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869)
Dec 01 05:07:25.683076 ubuntu systemd-udevd[474]: update old name,
'/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4' no longer
belonging to '/devices/virtual/block/bcache0'
Dec 01 05:07:25.683085 ubuntu systemd-udevd[474]: WARK:
link_update(name=/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4,
false
Dec 01 05:07:25.683094 ubuntu systemd-udevd[474]: no reference left, remove
'/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4'
Dec 01 05:07:25.683104 ubuntu systemd-udevd[474]: WARK:
dev_old_name=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869
dev_old_path=/devices/virtual/block/bcache0
Dec 01 05:07:25.683113 ubuntu systemd-udevd[474]: WARK:
dev_name=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869
dev_path=/devices/virtual/block/bcache0
Dec 01 05:07:25.683122 ubuntu systemd-udevd[474]: WARK:
streq(name=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869,
name_current=/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869)
Dec 01 05:07:25.683131 ubuntu systemd-udevd[474]: WARK: found match!
continue
Dec 01 05:07:25.683146 ubuntu systemd-udevd[474]: handling device node
'/dev/bcache0', devnum=b250:0, mode=0660, uid=0, gid=6
Dec 01 05:07:25.683155 ubuntu systemd-udevd[474]: set permissions
/dev/bcache0, 060660, uid=0, gid=6
Dec 01 05:07:25.683165 ubuntu systemd-udevd[474]: preserve already existing
symlink '/dev/block/250:0' to '../bcache0'
Dec 01 05:07:25.683174 ubuntu systemd-udevd[474]: found 'b250:0' claiming
'/run/udev/links/\x2fdisk\x2fby-uuid\x2f0a270acb-56b8-4498-8bad-b3bb149fe869'
Dec 01 05:07:25.683183 ubuntu systemd-udevd[474]: creating link
'/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869' to '/dev/bcache0'
Dec 01 05:07:25.683193 ubuntu systemd-udevd[474]: preserve already existing
symlink '/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869' to
'../../bcache0'
Dec 01 05:07:25.683201 ubuntu systemd-udevd[474]: created db file
'/run/udev/data/b250:0' for '/devices/virtual/block/bcache0'
Dec 01 05:07:25.683211 ubuntu systemd[1]:
dev-disk-by\x2duuid-0a270acb\x2d56b8\x2d4498\x2d8bad\x2db3bb149fe869.device:
Changed dead -> plugged
Dec 01 05:07:25.683226 ubuntu systemd[1]: dev-bcache0.device: Changed dead
-> plugged
Dec 01 05:07:25.683234 ubuntu systemd[1]:
sys-devices-virtual-block-bcache0.device: Changed dead -> plugged
The new dev (from /deb/bcache0) only has a by-uuid devlink as the UEVENT
that generates the CACHED_UUID devlink is not recorded/discovered
after the original binding of the cache device and backing store. This
forces udev to remove the link.
I hacked in a change which allows the old link to stay if the old_name, or
old_path match; this
keeps the symlinks around.
This is required (or the kernel fix to emit the CACHED_UUID on cold plug);
but not sufficient.
What else is needed is a change to the bcache rules file such that when a
bcacheN device is
replugged, it will query the backing device's superblock to find out the
dev.uuid, and import that
value as CACHED_UUID so that the dname rule can match the path
/dev/bcache/by-uuid/<CACHED_UUID> and dname
will point to that, which abstracts away whether it points to bcache0, 1 ,
or N.
On Thu, Nov 30, 2017 at 7:16 PM, Ryan Harper <email address hidden>
wrote:
> It looks like there is some ordering issues:
>
> This is a grep through /run/udev/links ; these are checked by udev-dev
>
> # find . -name 'b250*'
> ./\x2fdisk\x2fby-uuid\x2f0a270acb-56b8-4498-8bad-b3bb149fe869/b250:1
> ./\x2fdisk\x2fby-uuid\x2f92b0868d-7e56-4956-8e55-2c90ebee4a72/b250:0
> ./\x2fbcache\x2fby-uuid\x2f92d882d8-38cd-4537-847b-6f9c40ba67b4/b250:1
> ./\x2fbcache\x2fby-uuid\x2f57e009b1-6bf4-42ea-abe0-334b10941a0b/b250:0
>
> So both /dev/bcache/by-uuid and /dev/disk/by-uuid both point to the bcache
> device (b250:0)
>
> udevd shows this:
>
> Nov 30 23:39:10.738290 ubuntu systemd-udevd[465]: LINK
> 'disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869' /lib/udev/rules.d/60-
> persistent-storage.rules:79
> Nov 30 23:39:10.738304 ubuntu systemd-udevd[465]: update old name,
> '/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4' no longer
> belonging to '/devices/virtual/block/bcache1'
> Nov 30 23:39:10.738321 ubuntu systemd-udevd[465]: no reference left,
> remove '/dev/bcache/by-uuid/92d882d8-38cd-4537-847b-6f9c40ba67b4'
> Nov 30 23:39:10.738361 ubuntu systemd-udevd[465]: found 'b250:1' claiming
> '/run/udev/links/\x2fdisk\x2fby-uuid\x2f0a270acb-56b8-
> 4498-8bad-b3bb149fe869'
> Nov 30 23:39:10.738370 ubuntu systemd-udevd[465]: creating link
> '/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869' to '/dev/bcache1'
> Nov 30 23:39:10.738380 ubuntu systemd-udevd[465]: preserve already
> existing symlink '/dev/disk/by-uuid/0a270acb-56b8-4498-8bad-b3bb149fe869'
> to '../../bcache1'
> Nov 30 23:39:10.743215 ubuntu systemd-udevd[487]: LINK
> 'disk/by-uuid/92b0868d-7e56-4956-8e55-2c90ebee4a72' /lib/udev/rules.d/60-
> persistent-storage.rules:79
> Nov 30 23:39:10.743228 ubuntu systemd-udevd[487]: update old name,
> '/dev/bcache/by-uuid/57e009b1-6bf4-42ea-abe0-334b10941a0b' no longer
> belonging to '/devices/virtual/block/bcache0'
> Nov 30 23:39:10.743247 ubuntu systemd-udevd[487]: no reference left,
> remove '/dev/bcache/by-uuid/57e009b1-6bf4-42ea-abe0-334b10941a0b'
> Nov 30 23:39:10.743291 ubuntu systemd-udevd[487]: found 'b250:0' claiming
> '/run/udev/links/\x2fdisk\x2fby-uuid\x2f92b0868d-7e56-
> 4956-8e55-2c90ebee4a72'
> Nov 30 23:39:10.743302 ubuntu systemd-udevd[487]: creating link
> '/dev/disk/by-uuid/92b0868d-7e56-4956-8e55-2c90ebee4a72' to '/dev/bcache0'
> Nov 30 23:39:10.743312 ubuntu systemd-udevd[487]: preserve already
> existing symlink '/dev/disk/by-uuid/92b0868d-7e56-4956-8e55-2c90ebee4a72'
> to '../../bcache0'
>
> It would seem that the 'no longer belonging to ...bcache1' is the trigger
> for the removal
> however, 250:1 is indeed bcache1 device.
>
>
> # ls -al /dev/bcache1
> brw-rw---- 1 root disk 250, 1 Nov 30 23:39 /dev/bcache1
>
> Looking at the systemd/udev/udev-event.c it appears that for entries in
> the current udev database that don't have a new event associated with them
> get the call to remove the old link
>
> void udev_event_execute_rules()
> ...
> if (major(udev_device_get_devnum(dev)) > 0) {
> bool apply;
>
> /* remove/update possible left-over symlinks from
> old database entry */
> if (event->dev_db != NULL)
> udev_node_update_old_links(dev,
> event->dev_db);
>
>
> Will need to crawl through the db to see what the the event->dev_db entry
> is and where that get's set.
>
>
>
> On Thu, Nov 30, 2017 at 2:41 PM, Dmitrii Shcherbakov <
> <email address hidden>> wrote:
>
>> Looks like masking systemd-udevd removes this behavior. Need to figure
>> out where it actually clears everything out.
>>
>> ubuntu@maas-xenial4:~$ sudo systemctl mask systemd-udevd
>> 11:32 PM Created symlink from /etc/systemd/system/systemd-udevd.service
>> to /dev/null.
>>
>> # reboot
>>
>> ubuntu@maas-xenial4:~$ ls /dev/bcache/by-uuid/
>> 2963855b-3d2b-4387-abd1-3ae788919de4 727212eb-0f0b-4d20-9191-f0577a38454e
>> 835afacf-6213-48a9-864c-43733822668b aa04ab39-a42c-446f-aff5-addbd9
>> c80e06
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1729145
>>
>> Title:
>> /dev/bcache/by-uuid links not created after reboot
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
>> /+subscriptions
>>
>
>
Dec 01 05:07:25.679368 ubuntu systemd-udevd[474]: LINK uuid/0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' rules.d/ 60-persistent- storage. rules:79 name=/dev/ bcache/ by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4 path=/devices/ virtual/ block/bcache0 /dev/disk/ by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69 /devices/ virtual/ block/bcache0 /dev/bcache/ by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4, /dev/disk/ by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69) by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4' no longer virtual/ block/bcache0' name=/dev/ bcache/ by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4, by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4' name=/dev/ disk/by- uuid/0a270acb- 56b8-4498- 8bad-b3bb149fe8 69 path=/devices/ virtual/ block/bcache0 /dev/disk/ by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69 /devices/ virtual/ block/bcache0 /dev/disk/ by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69, /dev/disk/ by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69) links/\ x2fdisk\ x2fby-uuid\ x2f0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' to '/dev/bcache0' by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' to data/b250: 0' for '/devices/ virtual/ block/bcache0' by\x2duuid- 0a270acb\ x2d56b8\ x2d4498\ x2d8bad\ x2db3bb149fe869 .device: virtual- block-bcache0. device: Changed dead -> plugged
'disk/by-
/lib/udev/
Dec 01 05:07:25.683008 ubuntu systemd-udevd[474]: WARK:
dev_old_
dev_old_
Dec 01 05:07:25.683042 ubuntu systemd-udevd[474]: WARK:
dev_name=
dev_path=
Dec 01 05:07:25.683066 ubuntu systemd-udevd[474]: WARK:
streq(name=
name_current=
Dec 01 05:07:25.683076 ubuntu systemd-udevd[474]: update old name,
'/dev/bcache/
belonging to '/devices/
Dec 01 05:07:25.683085 ubuntu systemd-udevd[474]: WARK:
link_update(
false
Dec 01 05:07:25.683094 ubuntu systemd-udevd[474]: no reference left, remove
'/dev/bcache/
Dec 01 05:07:25.683104 ubuntu systemd-udevd[474]: WARK:
dev_old_
dev_old_
Dec 01 05:07:25.683113 ubuntu systemd-udevd[474]: WARK:
dev_name=
dev_path=
Dec 01 05:07:25.683122 ubuntu systemd-udevd[474]: WARK:
streq(name=
name_current=
Dec 01 05:07:25.683131 ubuntu systemd-udevd[474]: WARK: found match!
continue
Dec 01 05:07:25.683146 ubuntu systemd-udevd[474]: handling device node
'/dev/bcache0', devnum=b250:0, mode=0660, uid=0, gid=6
Dec 01 05:07:25.683155 ubuntu systemd-udevd[474]: set permissions
/dev/bcache0, 060660, uid=0, gid=6
Dec 01 05:07:25.683165 ubuntu systemd-udevd[474]: preserve already existing
symlink '/dev/block/250:0' to '../bcache0'
Dec 01 05:07:25.683174 ubuntu systemd-udevd[474]: found 'b250:0' claiming
'/run/udev/
Dec 01 05:07:25.683183 ubuntu systemd-udevd[474]: creating link
'/dev/disk/
Dec 01 05:07:25.683193 ubuntu systemd-udevd[474]: preserve already existing
symlink '/dev/disk/
'../../bcache0'
Dec 01 05:07:25.683201 ubuntu systemd-udevd[474]: created db file
'/run/udev/
Dec 01 05:07:25.683211 ubuntu systemd[1]:
dev-disk-
Changed dead -> plugged
Dec 01 05:07:25.683226 ubuntu systemd[1]: dev-bcache0.device: Changed dead
-> plugged
Dec 01 05:07:25.683234 ubuntu systemd[1]:
sys-devices-
The new dev (from /deb/bcache0) only has a by-uuid devlink as the UEVENT
that generates the CACHED_UUID devlink is not recorded/discovered
after the original binding of the cache device and backing store. This
forces udev to remove the link.
I hacked in a change which allows the old link to stay if the old_name, or
old_path match; this
keeps the symlinks around.
This is required (or the kernel fix to emit the CACHED_UUID on cold plug); by-uuid/ <CACHED_ UUID> and dname
but not sufficient.
What else is needed is a change to the bcache rules file such that when a
bcacheN device is
replugged, it will query the backing device's superblock to find out the
dev.uuid, and import that
value as CACHED_UUID so that the dname rule can match the path
/dev/bcache/
will point to that, which abstracts away whether it points to bcache0, 1 ,
or N.
/dev/disk/ by-dname/ foo -> ../../. ./bcache/ by-uuid/ <dev.uuid> ->
../../bcacheN
On Thu, Nov 30, 2017 at 7:16 PM, Ryan Harper <email address hidden>
wrote:
> It looks like there is some ordering issues: x2fby-uuid\ x2f0a270acb- 56b8-4498- 8bad-b3bb149fe8 69/b250: 1 x2fby-uuid\ x2f92b0868d- 7e56-4956- 8e55-2c90ebee4a 72/b250: 0 x2fby-uuid\ x2f92d882d8- 38cd-4537- 847b-6f9c40ba67 b4/b250: 1 x2fby-uuid\ x2f57e009b1- 6bf4-42ea- abe0-334b10941a 0b/b250: 0 uuid/0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' /lib/udev/ rules.d/ 60- storage. rules:79 by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4' no longer virtual/ block/bcache1' by-uuid/ 92d882d8- 38cd-4537- 847b-6f9c40ba67 b4' links/\ x2fdisk\ x2fby-uuid\ x2f0a270acb- 56b8- b3bb149fe869' by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' to '/dev/bcache1' by-uuid/ 0a270acb- 56b8-4498- 8bad-b3bb149fe8 69' uuid/92b0868d- 7e56-4956- 8e55-2c90ebee4a 72' /lib/udev/ rules.d/ 60- storage. rules:79 by-uuid/ 57e009b1- 6bf4-42ea- abe0-334b10941a 0b' no longer virtual/ block/bcache0' by-uuid/ 57e009b1- 6bf4-42ea- abe0-334b10941a 0b' links/\ x2fdisk\ x2fby-uuid\ x2f92b0868d- 7e56- 2c90ebee4a72' by-uuid/ 92b0868d- 7e56-4956- 8e55-2c90ebee4a 72' to '/dev/bcache0' by-uuid/ 92b0868d- 7e56-4956- 8e55-2c90ebee4a 72' udev/udev- event.c it appears that for entries in execute_ rules() udev_device_ get_devnum( dev)) > 0) { update_ old_links( dev, maas-xenial4: ~$ sudo systemctl mask systemd-udevd system/ systemd- udevd.service maas-xenial4: ~$ ls /dev/bcache/ by-uuid/ 3d2b-4387- abd1-3ae788919d e4 727212eb- 0f0b-4d20- 9191-f0577a3845 4e 6213-48a9- 864c-4373382266 8b aa04ab39- a42c-446f- aff5-addbd9 /bugs.launchpad .net/bugs/ 1729145 /bugs.launchpad .net/ubuntu/ +source/ linux/+ bug/1729145
>
> This is a grep through /run/udev/links ; these are checked by udev-dev
>
> # find . -name 'b250*'
> ./\x2fdisk\
> ./\x2fdisk\
> ./\x2fbcache\
> ./\x2fbcache\
>
> So both /dev/bcache/by-uuid and /dev/disk/by-uuid both point to the bcache
> device (b250:0)
>
> udevd shows this:
>
> Nov 30 23:39:10.738290 ubuntu systemd-udevd[465]: LINK
> 'disk/by-
> persistent-
> Nov 30 23:39:10.738304 ubuntu systemd-udevd[465]: update old name,
> '/dev/bcache/
> belonging to '/devices/
> Nov 30 23:39:10.738321 ubuntu systemd-udevd[465]: no reference left,
> remove '/dev/bcache/
> Nov 30 23:39:10.738361 ubuntu systemd-udevd[465]: found 'b250:1' claiming
> '/run/udev/
> 4498-8bad-
> Nov 30 23:39:10.738370 ubuntu systemd-udevd[465]: creating link
> '/dev/disk/
> Nov 30 23:39:10.738380 ubuntu systemd-udevd[465]: preserve already
> existing symlink '/dev/disk/
> to '../../bcache1'
> Nov 30 23:39:10.743215 ubuntu systemd-udevd[487]: LINK
> 'disk/by-
> persistent-
> Nov 30 23:39:10.743228 ubuntu systemd-udevd[487]: update old name,
> '/dev/bcache/
> belonging to '/devices/
> Nov 30 23:39:10.743247 ubuntu systemd-udevd[487]: no reference left,
> remove '/dev/bcache/
> Nov 30 23:39:10.743291 ubuntu systemd-udevd[487]: found 'b250:0' claiming
> '/run/udev/
> 4956-8e55-
> Nov 30 23:39:10.743302 ubuntu systemd-udevd[487]: creating link
> '/dev/disk/
> Nov 30 23:39:10.743312 ubuntu systemd-udevd[487]: preserve already
> existing symlink '/dev/disk/
> to '../../bcache0'
>
> It would seem that the 'no longer belonging to ...bcache1' is the trigger
> for the removal
> however, 250:1 is indeed bcache1 device.
>
>
> # ls -al /dev/bcache1
> brw-rw---- 1 root disk 250, 1 Nov 30 23:39 /dev/bcache1
>
> Looking at the systemd/
> the current udev database that don't have a new event associated with them
> get the call to remove the old link
>
> void udev_event_
> ...
> if (major(
> bool apply;
>
> /* remove/update possible left-over symlinks from
> old database entry */
> if (event->dev_db != NULL)
> udev_node_
> event->dev_db);
>
>
> Will need to crawl through the db to see what the the event->dev_db entry
> is and where that get's set.
>
>
>
> On Thu, Nov 30, 2017 at 2:41 PM, Dmitrii Shcherbakov <
> <email address hidden>> wrote:
>
>> Looks like masking systemd-udevd removes this behavior. Need to figure
>> out where it actually clears everything out.
>>
>> ubuntu@
>> 11:32 PM Created symlink from /etc/systemd/
>> to /dev/null.
>>
>> # reboot
>>
>> ubuntu@
>> 2963855b-
>> 835afacf-
>> c80e06
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https:/
>>
>> Title:
>> /dev/bcache/by-uuid links not created after reboot
>>
>> To manage notifications about this bug go to:
>> https:/
>> /+subscriptions
>>
>
>