** Description changed:

+ [Impact]
+ 
+  * Current users of bcache devices may encounter unreliable device
+    numbering as the Linux kernel does not guarantee that bcache
+    minor numbers are assigned to the same devices at each boot.
+    Users who may have used /dev/bcacheN in paths to a specific
+    device could possible be pointing to a different dataset
+    altogether.  bcache udev rules do provide some mechanism to
+    generate persistent symlinks in /dev/bcache/by-uuid or
+    /dev/bcache/by-label which is based on superblock data on
+    the underlying device.  However, the Linux kernel does not
+    always generate an kernel uevent to trigger the udev rules
+    to create the symlink.
+ 
+  * The fix adds a udev program which will read bcache superblock
+    of slave devices and extract the UUID and LABEL, exporting them
+    to udev for use in the bcache rule files.
+ 
+  * This is affected in upstream bcache-tools, the owning package
+    of the udev rules.  This affects all releases of bcache-tools
+    as the rules rely upon the kernel to trigger these events,
+    though that is not a requirement to resolve the lack of
+    persistent links.
+  
+ [Test Case]
+ 
+  * Launch and Ubuntu Cloud Image with 3 unused disks
+    - apt install bcache-tools tree
+    - make-bcache -C /dev/vdb
+    - make-bcache -B /dev/vdc
+    - make-bcache -B /dev/vdd
+    - echo "vdc" > /sys/class/block/bcache0/bcache/label
+    - echo "vdd" > /sys/class/block/bcache1/bcache/label
+    - reboot
+ 
+    - Run this test:
+ 
+     #!/bin/bash
+     FAIL=0
+     [ ! -d /dev/bcache ] && { 
+         echo "FAIL: /dev/bcache is not a directory";
+         exit 1
+     }
+     for label in /dev/bcache/by-label/*; do
+         LABEL_TARGET="$(ls -1 /sys/class/block/`basename $label`/holders/)"
+         DEVNAME=`readlink -f $label`;
+         KNAME="${DEVNAME#*/dev/}"
+         if [ "$LABEL_TARGET" != "$KNAME" ]; then
+             echo "FAIL: label points to $LABEL_TARGET but symlink points to 
$DEVNAME";
+             FAIL=1
+         fi;
+     done
+     if [ "$FAIL" == "0" ]; then
+         echo "PASS";
+         exit 0
+     fi
+     exit 1
+ 
+  
+ [Regression Potential]
+ 
+  * As bcache minor numbers and these symlinks have been unreliable in
+    the past there may be code that makes assumptions about
+    /dev/bcache* expanded only to the block devices, versus
+    /dev/bcache which is a directory.
+ 
+ 
+ [Original Description]
+ 
  Bcache device names like /dev/bcache0 are unstable.  Bcache does not use
  any predictable ordering when assembling bcache devices, so on systems
  with multiple bcache devices, a symlink to /dev/bcache0 may end up
  pointing do a different device.
  
  the bcache dname symlink should point to the /dev/bcache/by-uuid/<UUID>
  which matches the backing device UUID that's set at creation time.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1728742

Title:
  curtin dname for bcache uses unstable devname instead of UUID

To manage notifications about this bug go to:
https://bugs.launchpad.net/bcache-tools/+bug/1728742/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to