Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 503330

Summary: sys-fs/bcache-tools - /lib/udev/rules.d/69-bcache.rules fails to detect backing devices
Product: Gentoo Linux Reporter: devsk <funtoos>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED OBSOLETE    
Severity: normal CC: anton.wd, jstein
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description devsk 2014-03-03 16:42:25 UTC
blkid can not list FS types if there are multiple of them in there. It gets all confused. wipefs finds all of them, and so does a low level probe which the UDEV rules for bcache don't do.

# /sbin/blkid /dev/sdg1
# wipefs /dev/sdg1
offset               type
----------------------------------------------------------------
0x25000              zfs_member   [raid]

0x1018               bcache   [other]
                     UUID:  2d4c7ca4-9e38-4364-be14-b517c83b1d6f
# /sbin/blkid -p -u other -o udev /dev/sdg1
ID_FS_UUID=2d4c7ca4-9e38-4364-be14-b517c83b1d6f
ID_FS_UUID_ENC=2d4c7ca4-9e38-4364-be14-b517c83b1d6f
ID_FS_TYPE=bcache
ID_FS_USAGE=other
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_UUID=000b2d00-01
ID_PART_ENTRY_TYPE=0x83
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=2048
ID_PART_ENTRY_SIZE=1953523120
ID_PART_ENTRY_DISK=8:96

The following patch to the UDEV rules file (/lib/udev/rules.d/69-bcache*) fixes the detection issue and creation of /dev/bcache0 but it does not create the UUID based symlink in /dev/bcache/by-uuid. I am not sure how to do that.

@@ -7,6 +7,7 @@
 
 # blkid was run by the standard udev rules
 # It recognised bcache (util-linux 2.24+)
+IMPORT{program}="/sbin/blkid -p -u other -o udev  $tempnode"
 ENV{ID_FS_TYPE}=="bcache", GOTO="bcache_backing_found"
 # It recognised something else; bail
 ENV{ID_FS_TYPE}=="?*", GOTO="bcache_backing_end"

Reproducible: Always

Steps to Reproduce:
1. Format cache and backing device
2. Use the bcache device for ZFS
3. Reboot
Actual Results:  
The bcache device device is not recreated.

Expected Results:  
The bcache device should be recreated by udev because it still has bcache formatting.
Comment 1 devsk 2014-03-03 16:43:06 UTC
The second part of the issue seems to be because probe-bcache -o udev is not returning anything.

Can we fix it by having this code:

# Cached devices: symlink
DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
        SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
DRIVER=="bcache", ENV{CACHED_LABEL}=="?*", \
        SYMLINK+="bcache/by-label/$env{CACHED_LABEL}"

replaced with:

# Cached devices: symlink
DRIVER=="bcache", ENV{ID_FS_UUID}=="?*", \
        SYMLINK+="bcache/by-uuid/$env{ID_FS_UUID}"
DRIVER=="bcache", ENV{ID_FS_LABEL}=="?*", \
        SYMLINK+="bcache/by-label/$env{ID_FS_LABEL}"
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2014-03-06 09:54:32 UTC
Thanks for report and tracking it down. I will see what upstream is working on.
Comment 3 Justin Lecher (RETIRED) gentoo-dev 2014-03-06 10:38:28 UTC
Could you please file a bug for this upstream(https://github.com/g2p/bcache-tools) and add the link here?
Comment 4 devsk 2014-03-15 17:33:41 UTC
I gave up on bcache. It just doesn't work for my use case. See https://bugzilla.kernel.org/show_bug.cgi?id=71441. Not getting much help from upstream kernel developer on the kernel issue didn't increase chances of my following up...:-)
Comment 5 Jonas Stein gentoo-dev 2021-01-17 17:25:45 UTC
https://bugzilla.kernel.org/show_bug.cgi?id=71441#c3
"Does this problem still show up in Linux v5.5 or v5.6-rc ?"
Please report there and here.
Comment 6 devsk 2021-01-17 18:57:30 UTC
Closing this 7 year old bug. Not using bcache.