69-bcache.rules Tries to Re-register bcache that is already registered and attached

Bug #1989734 reported by Joshua Diamant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bcache-tools
New
Unknown
bcache-tools (Ubuntu)
New
Undecided
Unassigned
Jammy
Confirmed
Undecided
Unassigned

Bug Description

I have been using bcache for two drives (/dev/sda and /dev/sdb). The cache is registered correctly, but it looks like the UDEV rules in 69-bcache.rules need to be tweaked to identify if a bcache is already mounted when jumping to bcache_backing_found (line 22 is where the bcache-register command is run).

/var/log/messages

Sep 15 10:29:15 HTPC-Xeon systemd-udevd[3213322]: sda: Process 'bcache-register /dev/sda' failed with exit code 1.
Sep 15 10:29:15 HTPC-Xeon kernel: [132665.473836] bcache: register_bcache() error : device already registered
Sep 15 10:29:17 HTPC-Xeon systemd-udevd[3213322]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:17 HTPC-Xeon kernel: [132668.109215] bcache: register_bcache() error : device already registered
Sep 15 10:29:18 HTPC-Xeon systemd-udevd[3213433]: sda: Process 'bcache-register /dev/sda' failed with exit code 1.
Sep 15 10:29:18 HTPC-Xeon kernel: [132668.472411] bcache: register_bcache() error : device already registered
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213433]: message repeated 46 times: [ sda: Process 'bcache-register /dev/sda' failed with exit code 1.]
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213481]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:19 HTPC-Xeon kernel: [132669.919959] bcache: register_bcache() error : device already registered
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213433]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:19 HTPC-Xeon kernel: [132669.970662] bcache: register_bcache() error : device already registered
Sep 15 10:29:20 HTPC-Xeon systemd-udevd[3213433]: message repeated 45 times: [ sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.]

root@HTPC-Xeon:/# bcache-super-show /dev/sda
sb.magic ok
sb.first_sector 8 [match]
sb.csum 6AEA0E3D0A952CEF [match]
sb.version 4 [backing device]

dev.label NAS
dev.uuid 6b52e51f-6c9f-4b7e-a245-9d2b63fc4bc5
dev.sectors_per_block 1
dev.sectors_per_bucket 1024
dev.data.first_sector 645120
dev.data.cache_mode 1 [writeback]
dev.data.cache_state 1 [clean]

cset.uuid e960d897-9990-47ab-90f9-69163b7d45b0

root@HTPC-Xeon:/# bcache-super-show /dev/sdb
sb.magic ok
sb.first_sector 8 [match]
sb.csum D19F0AAACEBB036B [match]
sb.version 4 [backing device]

dev.label BACKUP
dev.uuid 6c18a7f6-73ba-46a1-973f-9f296a42175b
dev.sectors_per_block 1
dev.sectors_per_bucket 1024
dev.data.first_sector 645120
dev.data.cache_mode 1 [writeback]
dev.data.cache_state 2 [dirty]

cset.uuid e960d897-9990-47ab-90f9-69163b7d45b0

root@HTPC-Xeon:/# bcache-status
--- bcache ---
Device /dev/sda (8:0)
UUID e960d897-9990-47ab-90f9-69163b7d45b0
Block Size 0.50KiB
Bucket Size 512.00KiB
Congested? False
Read Congestion 2.0ms
Write Congestion 20.0ms
Total Cache Size 1.09TiB
Total Cache Used 1.09TiB (100%)
Total Cache Unused 0B (0%)
Dirty Data 0.50KiB (0%)
Evictable Cache 905.42GiB (81%)
Replacement Policy [lru] fifo random
Cache Mode writethrough [writeback] writearound none
Total Hits 1916371 (63%)
Total Misses 1117878
Total Bypass Hits 791703 (24%)
Total Bypass Misses 2470122
Total Bypassed 103.00GiB

root@HTPC-Xeon:/# apt-cache policy bcache-tools
bcache-tools:
  Installed: 1.0.8-4ubuntu3
  Candidate: 1.0.8-4ubuntu3
  Version table:
 *** 1.0.8-4ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status
root@HTPC-Xeon:/# lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04

Revision history for this message
Joshua Diamant (joshdi) wrote :

If I add this line below after line 5 of /lib/udev/rules.d/69-bcache.rules, the errors go away and when I reboot the bcache is correctly mounted/registered.

ACTION=="change", GOTO="bcache_end"

Is there any risk to adding this? Is there a better way to fix this problem? Thank you!

Revision history for this message
Lena Voytek (lvoytek) wrote :

Hello,
Thank you for taking the time to make this bug report. This seems like a valid solution to the issue, but I'd be curious to see if upstream has anything specific to say about it. I noticed you added the bug upstream, thank you for that. I will add its status here. In the meantime I created a PPA that contains your change on line 6 of 69-bcache.rules, located here if you need it:
https://launchpad.net/~lvoytek/+archive/ubuntu/bcache-fix-attempted-re-register-jammy

Changed in bcache-tools (Ubuntu Jammy):
status: New → Confirmed
Changed in bcache-tools:
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.