diff -Nru bcache-tools-1.0.8/debian/changelog bcache-tools-1.0.8/debian/changelog --- bcache-tools-1.0.8/debian/changelog 2018-03-27 20:21:51.000000000 +0200 +++ bcache-tools-1.0.8/debian/changelog 2020-05-20 00:16:16.000000000 +0200 @@ -1,3 +1,9 @@ +bcache-tools (1.0.8-3ubuntu1) groovy; urgency=medium + + * Keep /dev/bcache/by-*/* symlinks (LP: #1861941) + + -- Balint Reczey Wed, 20 May 2020 00:16:16 +0200 + bcache-tools (1.0.8-3) unstable; urgency=medium * d/bcache-tools.preinst: fail on unexpected error (Closes: #866250). diff -Nru bcache-tools-1.0.8/debian/control bcache-tools-1.0.8/debian/control --- bcache-tools-1.0.8/debian/control 2018-03-27 20:20:54.000000000 +0200 +++ bcache-tools-1.0.8/debian/control 2020-05-20 00:16:16.000000000 +0200 @@ -1,5 +1,6 @@ Source: bcache-tools -Maintainer: David Mohr +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: David Mohr Uploaders: Robie Basak Section: utils Priority: optional diff -Nru bcache-tools-1.0.8/debian/patches/series bcache-tools-1.0.8/debian/patches/series --- bcache-tools-1.0.8/debian/patches/series 2018-03-27 18:44:16.000000000 +0200 +++ bcache-tools-1.0.8/debian/patches/series 2020-05-20 00:14:12.000000000 +0200 @@ -1,2 +1,3 @@ 0001-Clean-should-remove-bcache-register.patch 0002-Don-t-inline-crc64-for-gcc-5-compatibility.patch +udev-keep-symlinks.patch diff -Nru bcache-tools-1.0.8/debian/patches/udev-keep-symlinks.patch bcache-tools-1.0.8/debian/patches/udev-keep-symlinks.patch --- bcache-tools-1.0.8/debian/patches/udev-keep-symlinks.patch 1970-01-01 01:00:00.000000000 +0100 +++ bcache-tools-1.0.8/debian/patches/udev-keep-symlinks.patch 2020-05-20 00:16:16.000000000 +0200 @@ -0,0 +1,50 @@ +Description: Keep symlinks when udev changes /dev/bcacheN +Author: Balint Reczey +Origin: vendor +Bug-Ubuntu: https://launchpad.net/bugs/1861941 +Last-Update: 2020-05-19 + +--- a/69-bcache.rules ++++ b/69-bcache.rules +@@ -30,3 +30,9 @@ + + LABEL="bcache_end" + ++# keep symlinks when the block device is changed by a different driver ++DRIVER!="bcache", ENV{DEVNAME}=="/dev/bcache[0-9]*" ACTION=="change", ENV{DEVLINKS}=="?*",IMPORT{program}="bcache-keep-symlinks $env{DEVNAME}" ++ENV{BCACHE_CACHED_UUID}=="?*", \ ++ SYMLINK+="bcache/by-uuid/$env{BCACHE_CACHED_UUID}" ++ENV{BCACHE_CACHED_LABEL}=="?*", \ ++ SYMLINK+="bcache/by-label/$env{BCACHE_CACHED_LABEL}" +--- a/Makefile ++++ b/Makefile +@@ -9,7 +9,7 @@ + + install: make-bcache probe-bcache bcache-super-show + $(INSTALL) -m0755 make-bcache bcache-super-show $(DESTDIR)${PREFIX}/sbin/ +- $(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/ ++ $(INSTALL) -m0755 probe-bcache bcache-register bcache-keep-symlinks $(DESTDIR)$(UDEVLIBDIR)/ + $(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/ + $(INSTALL) -m0644 -- *.8 $(DESTDIR)${PREFIX}/share/man/man8/ + $(INSTALL) -D -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache +--- /dev/null ++++ b/bcache-keep-symlinks +@@ -0,0 +1,18 @@ ++#!/bin/sh ++ ++DEVNAME=$1 ++ ++for link in /dev/bcache/by-uuid/*; do ++ if [ -n "$DEVNAME" -a "$DEVNAME" = "$(readlink -f $link)" ]; then ++ echo "BCACHE_CACHED_UUID=$(basename $link)" ++ break ++ fi ++done ++ ++for link in /dev/bcache/by-label/*; do ++ if [ -n "$DEVNAME" -a "$DEVNAME" = "$(readlink -f $link)" ]; then ++ echo "BCACHE_CACHED_LABEL=$(basename $link)" ++ break ++ fi ++done ++