Merge ~rafaeldtinoco/ubuntu/+source/bcache-tools:lp1861941-focal into ubuntu/+source/bcache-tools:ubuntu/focal-devel

Proposed by Rafael David Tinoco
Status: Merged
Merge reported by: Rafael David Tinoco
Merged at revision: 38c3df83190c8524e687a338a0e75e41e4b545dc
Proposed branch: ~rafaeldtinoco/ubuntu/+source/bcache-tools:lp1861941-focal
Merge into: ubuntu/+source/bcache-tools:ubuntu/focal-devel
Diff against target: 154 lines (+115/-2)
4 files modified
debian/changelog (+7/-0)
debian/control (+3/-2)
debian/patches/0003-Add-bcache-export-cached-helper.patch (+104/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Rafael David Tinoco (community) Approve
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+387909@code.launchpad.net

Commit message

SUMMARY:

BUG: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941
TESTCASE: https://paste.ubuntu.com/p/37KGy2Smnp/
PPA: https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1861941

BCACHE-TOOLS:

GROOVY: https://tinyurl.com/yxonp5hz (needs-review for an upload)
FOCAL: https://tinyurl.com/y3tbd3un (needs-review for SRU)
BIONIC: Will be done after Groovy and Focal are reviewed.

SYSTEMD-UDEV:

GROOVY: https://tinyurl.com/y4w22s57 (merged patch rewording, will wait next upload)
FOCAL: https://tinyurl.com/y2uqbyll (merged patch, will ask for an upload - SRU)
BIONIC: Will be done after Groovy and Focal are reviewed.

KERNEL:

After Groovy, Focal and Bionic are fixed (bcache-tools and systemd-udev), I'll send a SRU request for 3 kernels to remove bcache patches created for old bcache/udev rules bug (not needed after this bcache-tools fix).

----

This is basically the same change proposed to Debian and Upstream:

https://github.com/koverstreet/bcache-tools/pull/6/
https://salsa.debian.org/debian/bcache-tools/-/merge_requests/2

Being applied to Groovy to resolve LP: #1861941.

Reviewer: don't worry too much on the functionality but rather the "merge protocol". The MAAS team is doing all the tests in the PPA I'm providing to them:

https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1861941

And, for this merge, being SRU'ed to Focal.

----

Good summary of the issue:

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941/comments/27
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941/comments/47
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941/comments/56
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941/comments/62

And this MR is the bcache-tools fix.

Note: Upstream isn't merging our requests for sometime now, but we are doing all tests at our side to make sure that, even if we have to carry this as a delta (from upstream) it works smoothly.

To post a comment you must log in.
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Positive feedback for focal pkgs from PPA from QA team (testing with MAAS and JuJu):

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1861941/comments/73

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

The changes for systemd-udev were pushed into:

https://code.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/+git/systemd/+ref/ubuntu-focal already (after discussion with @ddstreet)

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

waiting for the groovy MP to conclude - only Focal SRU specific feedback is here on this MP:

1. version 1.0.8-3ubuntu1 => 1.0.8-3ubuntu0.1

There could be someone with an ubuntu1 in an interim PPA, versioning rules imply 0.1 being better here.

2. (LP #1861941) => (LP: #1861941)

In the Focal case there wasn't even a former mention of the bug, so make it actively trigger.
Especially important for SRU handling BTW for the tools to find the bug to update.

review: Needs Fixing
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Made the same changes as the groovy version.

Based on my answer to:

https://code.launchpad.net/~rafaeldtinoco/ubuntu/+source/bcache-tools/+git/bcache-tools/+merge/387908/comments/1020349

Please let me know if you are +1 for me on uploading this as well, together with the groovy one.

Thank you for reviewing this.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Yeah, like on groovy MP +1 now.

review: Approve
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

c)rafaeldtinoco@focal:~/.../sources/ubuntu/bcache-tools$ git ubuntu tag --upload

(c)rafaeldtinoco@focal:~/.../sources/ubuntu/bcache-tools$ git describe --tags
upload/1.0.8-3ubuntu0.1

$ git push pkg upload/1.0.8-3ubuntu0.1
Enumerating objects: 22, done.
Counting objects: 100% (22/22), done.
Delta compression using up to 8 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 3.48 KiB | 1.74 MiB/s, done.
Total 16 (delta 11), reused 0 (delta 0)
To ssh://git.launchpad.net/ubuntu/+source/bcache-tools
 * [new tag] upload/1.0.8-3ubuntu0.1 -> upload/1.0.8-3ubuntu0.1

$ debdiff bcache-tools_1.0.8-3.dsc bcache-tools_1.0.8-3ubuntu0.1.dsc | diffstat
 changelog | 7 +++
 control | 5 +-
 patches/0003-Add-bcache-export-cached-helper.patch | 104 +++++++++++++++++++++++++++++++++++++++++++++
 patches/series | 1
 4 files changed, 115 insertions(+), 2 deletions(-)

$ dput ubuntu bcache-tools_1.0.8-3ubuntu0.1_source.changes
Checking signature on .changes
gpg: /home/rafaeldtinoco/work/sources/ubuntu/bcache-tools_1.0.8-3ubuntu0.1_source.changes: Valid signature from A93E0E0AD83C0D0F
Checking signature on .dsc
gpg: /home/rafaeldtinoco/work/sources/ubuntu/bcache-tools_1.0.8-3ubuntu0.1.dsc: Valid signature from A93E0E0AD83C0D0F
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading bcache-tools_1.0.8-3ubuntu0.1.dsc: done.
  Uploading bcache-tools_1.0.8-3ubuntu0.1.debian.tar.xz: done.
  Uploading bcache-tools_1.0.8-3ubuntu0.1_source.buildinfo: done.
  Uploading bcache-tools_1.0.8-3ubuntu0.1_source.changes: done.
Successfully uploaded packages.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7149915..14617c1 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+bcache-tools (1.0.8-3ubuntu0.1) focal; urgency=medium
7+
8+ [ Ryan Harper ]
9+ * Add helper script to read bcache devs superblock (LP: #1861941)
10+
11+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Thu, 23 Jul 2020 00:33:50 +0000
12+
13 bcache-tools (1.0.8-3) unstable; urgency=medium
14
15 * d/bcache-tools.preinst: fail on unexpected error (Closes: #866250).
16diff --git a/debian/control b/debian/control
17index 2cedcac..6437f35 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,5 +1,6 @@
21 Source: bcache-tools
22-Maintainer: David Mohr <david@mcbf.net>
23+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
24+XSBC-Original-Maintainer: David Mohr <david@mcbf.net>
25 Uploaders: Robie Basak <robie@justgohome.co.uk>
26 Section: utils
27 Priority: optional
28@@ -11,7 +12,7 @@ Homepage: https://bcache.evilpiepirate.org/
29
30 Package: bcache-tools
31 Architecture: linux-any
32-Depends: ${misc:Depends}, ${shlibs:Depends}
33+Depends: ${misc:Depends}, ${shlibs:Depends}, gawk
34 Recommends: initramfs-tools | linux-initramfs-tool
35 Description: bcache userspace tools
36 Bcache allows the use of SSDs to cache other block devices.
37diff --git a/debian/patches/0003-Add-bcache-export-cached-helper.patch b/debian/patches/0003-Add-bcache-export-cached-helper.patch
38new file mode 100644
39index 0000000..ffc6ff1
40--- /dev/null
41+++ b/debian/patches/0003-Add-bcache-export-cached-helper.patch
42@@ -0,0 +1,104 @@
43+Description: Add bcache-export-cached helper to export CACHED_UUID and
44+ CACHED_LABEL always
45+
46+Linux kernel bcache driver does not always emit a uevent[1] for when a backing
47+device is bound to a bcacheN device. When this happens, the udev rule for
48+creating /dev/bcache/by-uuid or /dev/bcache/by-label symlinks does not fire and
49+removes any persistent symlink to a specific backing device since the bcache
50+minor numbers (bcache0, 1, 2) are not guaranteed across reboots.
51+
52+This script reads the superblock of the bcache device slaves, ensuring the
53+slave is a backing device via sb.version check, extracts the dev.uuid and
54+dev.label values and exports them to udev for triggering the symlink rules in
55+the existing rules file.
56+
57+1. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145
58+
59+Author: Ryan Harper <ryan.harper@canonical.com>
60+Bug: https://bugs.debian.org/890446
61+Bug-Ubuntu: https://launchpad.net/bugs/1861941
62+Forwarded: https://github.com/koverstreet/bcache-tools/pull/6/
63+Reviewed-By: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
64+Last-Update: 2020-07-22
65+
66+--- bcache-tools-1.0.8.orig/69-bcache.rules
67++++ bcache-tools-1.0.8/69-bcache.rules
68+@@ -23,10 +23,9 @@ RUN+="bcache-register $tempnode"
69+ LABEL="bcache_backing_end"
70+
71+ # Cached devices: symlink
72+-DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
73+- SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
74+-DRIVER=="bcache", ENV{CACHED_LABEL}=="?*", \
75+- SYMLINK+="bcache/by-label/$env{CACHED_LABEL}"
76++IMPORT{program}="bcache-export-cached $tempnode"
77++ENV{CACHED_UUID}=="?*", SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
78++ENV{CACHED_LABEL}=="?*", SYMLINK+="bcache/by-label/$env{CACHED_LABEL}"
79+
80+ LABEL="bcache_end"
81+
82+--- bcache-tools-1.0.8.orig/Makefile
83++++ bcache-tools-1.0.8/Makefile
84+@@ -9,7 +9,7 @@ all: make-bcache probe-bcache bcache-sup
85+
86+ install: make-bcache probe-bcache bcache-super-show
87+ $(INSTALL) -m0755 make-bcache bcache-super-show $(DESTDIR)${PREFIX}/sbin/
88+- $(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/
89++ $(INSTALL) -m0755 probe-bcache bcache-register bcache-export-cached $(DESTDIR)$(UDEVLIBDIR)/
90+ $(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/
91+ $(INSTALL) -m0644 -- *.8 $(DESTDIR)${PREFIX}/share/man/man8/
92+ $(INSTALL) -D -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
93+--- /dev/null
94++++ bcache-tools-1.0.8/bcache-export-cached
95+@@ -0,0 +1,31 @@
96++#!/bin/sh
97++#
98++# This program reads the bcache superblock on bcacheX slaves to extract the
99++# dev.uuid and dev.label which refer to a specific backing device.
100++#
101++# It integrates with udev 'import' by writing CACHED_UUID=X and optionally
102++# CACHED_LABEL=X for the backing device of the provided bcache device.
103++# Ignore caching devices by skipping unless sb.version=1
104++#
105++# There is 1 and only 1 backing device (slaves/*) for a bcache device.
106++
107++TEMPNODE=${1} # /dev/bcacheN
108++DEVNAME=${TEMPNODE##*/} # /dev/bcacheN -> bcacheN
109++
110++for slave in "/sys/class/block/$DEVNAME/slaves"/*; do
111++ [ -d "$slave" ] || continue
112++ /usr/sbin/bcache-super-show "/dev/${slave##*/}" |
113++ awk '$1 == "sb.version" { sbver=$2; }
114++ $1 == "dev.uuid" { uuid=$2; }
115++ $1 == "dev.label" && $2 != "(empty)" { label=$2; }
116++ END {
117++ if (sbver == 1 && uuid) {
118++ print("CACHED_UUID=" uuid)
119++ if (label) print("CACHED_LABEL=" label)
120++ exit(0)
121++ }
122++ exit(1);
123++ }'
124++ # awk exits 0 if it found a backing device.
125++ [ $? -eq 0 ] && exit 0
126++done
127+--- bcache-tools-1.0.8.orig/initcpio/install
128++++ bcache-tools-1.0.8/initcpio/install
129+@@ -1,6 +1,7 @@
130+ #!/bin/bash
131+ build() {
132+ add_module bcache
133++ add_binary /usr/lib/udev/bcache-export-cached
134+ add_binary /usr/lib/udev/bcache-register
135+ add_binary /usr/lib/udev/probe-bcache
136+ add_file /usr/lib/udev/rules.d/69-bcache.rules
137+--- bcache-tools-1.0.8.orig/initramfs/hook
138++++ bcache-tools-1.0.8/initramfs/hook
139+@@ -22,6 +22,7 @@ elif [ -e /lib/udev/rules.d/69-bcache.ru
140+ cp -pt "${DESTDIR}/lib/udev/rules.d" /lib/udev/rules.d/69-bcache.rules
141+ fi
142+
143++copy_exec /lib/udev/bcache-export-cached
144+ copy_exec /lib/udev/bcache-register
145+ copy_exec /lib/udev/probe-bcache
146+ manual_add_modules bcache
147diff --git a/debian/patches/series b/debian/patches/series
148index 209d512..2db46fa 100644
149--- a/debian/patches/series
150+++ b/debian/patches/series
151@@ -1,2 +1,3 @@
152 0001-Clean-should-remove-bcache-register.patch
153 0002-Don-t-inline-crc64-for-gcc-5-compatibility.patch
154+0003-Add-bcache-export-cached-helper.patch

Subscribers

People subscribed via source and target branches