bcache-tools
                                
                                
                                
                                    bcache-tools copied to clipboard
                            
                            
                            
                        Add bcache-export-cached helper to export CACHED_UUID and CACHED_LABEL
Linux kernel bcache driver does not always emit a uevent[1] for when a backing device is bound to a bcacheN device. When this happens, the udev rule for creating /dev/bcache/by-uuid or /dev/bcache/by-label symlinks does not fire and removes any persistent symlink to a specific backing device since the bcache minor numbers (bcache0, 1, 2) are not guaranteed across reboots[2][3].
This script reads the superblock of the bcache device slaves, ensuring the slave is a backing device via sb.version check, extracts the dev.uuid and dev.label values and exports them to udev for triggering the symlink rules in the existing rules file.
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
 - https://bugs.launchpad.net/bcache-tools/+bug/1728742
 - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890446
 
Can we just fix the kernel to always emit the uevent? Has that been looked at?
On Feb 15, 2018 09:48, "Ryan Harper" [email protected] wrote:
Linux kernel bcache driver does not always emit a uevent[1] for when a backing device is bound to a bcacheN device. When this happens, the udev rule for creating /dev/bcache/by-uuid or /dev/bcache/by-label symlinks does not fire and removes any persistent symlink to a specific backing device since the bcache minor numbers (bcache0, 1, 2) are not guaranteed across reboots[2][3].
This script reads the superblock of the bcache device slaves, ensuring the slave is a backing device via sb.version check, extracts the dev.uuid and dev.label values and exports them to udev for triggering the symlink rules in the existing rules file.
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
 - https://bugs.launchpad.net/bcache-tools/+bug/1728742
 - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890446
 
You can view, comment on, or merge this pull request online at:
https://github.com/koverstreet/bcache-tools/pull/1 Commit Summary
- Add bcache-export-cached helper to export CACHED_UUID and CACHED_LABEL always
 File Changes
- M 69-bcache.rules https://github.com/koverstreet/bcache-tools/pull/1/files#diff-0 (7)
 - M Makefile https://github.com/koverstreet/bcache-tools/pull/1/files#diff-1 (2)
 - A bcache-export-cached https://github.com/koverstreet/bcache-tools/pull/1/files#diff-2 (31)
 - M initcpio/install https://github.com/koverstreet/bcache-tools/pull/1/files#diff-3 (1)
 - M initramfs/hook https://github.com/koverstreet/bcache-tools/pull/1/files#diff-4 (1)
 Patch Links:
- https://github.com/koverstreet/bcache-tools/pull/1.patch
 - https://github.com/koverstreet/bcache-tools/pull/1.diff
 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/koverstreet/bcache-tools/pull/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5r7moaGvFIV3TyXyVdDcyS93SV2ecHks5tVEPIgaJpZM4SG9M3 .
On Thu, Feb 15, 2018 at 10:09 AM, koverstreet [email protected] wrote:
Can we just fix the kernel to always emit the uevent? Has that been looked at?
Yes, we have.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
Specifically: https://launchpadlibrarian.net/348212191/0001-bcache-decouple-emitting-a-cached_dev-CHANGE-uevent.patch
It may, or may not make it back to much older kernels were bcache is in use; so similar to working around blkid versions which didn't detect bcache, it's still useful to have a user-space solution.
On Feb 15, 2018 09:48, "Ryan Harper" [email protected] wrote:
Linux kernel bcache driver does not always emit a uevent[1] for when a backing device is bound to a bcacheN device. When this happens, the udev rule for creating /dev/bcache/by-uuid or /dev/bcache/by-label symlinks does not fire and removes any persistent symlink to a specific backing device since the bcache minor numbers (bcache0, 1, 2) are not guaranteed across reboots[2][3].
This script reads the superblock of the bcache device slaves, ensuring the slave is a backing device via sb.version check, extracts the dev.uuid and dev.label values and exports them to udev for triggering the symlink rules in the existing rules file.
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
 - https://bugs.launchpad.net/bcache-tools/+bug/1728742
 - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890446
 
You can view, comment on, or merge this pull request online at:
https://github.com/koverstreet/bcache-tools/pull/1 Commit Summary
- Add bcache-export-cached helper to export CACHED_UUID and CACHED_LABEL always
 File Changes
- M 69-bcache.rules https://github.com/koverstreet/bcache-tools/pull/1/files#diff-0 (7)
 - M Makefile https://github.com/koverstreet/bcache-tools/pull/1/files#diff-1 (2)
 - A bcache-export-cached https://github.com/koverstreet/bcache-tools/pull/1/files#diff-2 (31)
 - M initcpio/install https://github.com/koverstreet/bcache-tools/pull/1/files#diff-3 (1)
 - M initramfs/hook https://github.com/koverstreet/bcache-tools/pull/1/files#diff-4 (1)
 Patch Links:
- https://github.com/koverstreet/bcache-tools/pull/1.patch
 - https://github.com/koverstreet/bcache-tools/pull/1.diff
 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/koverstreet/bcache-tools/pull/1, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AB5r7moaGvFIV3TyXyVdDcyS93SV2ecHks5tVEPIgaJpZM4SG9M3> .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/koverstreet/bcache-tools/pull/1#issuecomment-365975522, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbJU7uxSGUgVl6qQ2MUgEYx60qhlvOCks5tVFa-gaJpZM4SG9M3 .
For the record, here are the upstream kernel submission discussions:
- https://patchwork.kernel.org/patch/10252315/
 - https://lkml.org/lkml/2018/3/1/812
 - https://www.spinics.net/lists/linux-bcache/msg05833.html
 
Please close this PULL REQUEST as it is outdated. Latest version is in:
https://github.com/koverstreet/bcache-tools/pull/6
@raharper I amended your patch with the PATH change and will go from there. Keeping credits and all, just so you dont have to worry about following this closer. Doing the Debian & Ubuntu inner work now.