On Fri, Jan 12, 2018 at 11:18:34PM +0100, Julian Andres Klode wrote: > On Thu, Jan 11, 2018 at 02:52:16PM +0100, Julian Andres Klode wrote: > > Package: multipath-tools > > Version: 0.7.4-2 > > Severity: important > > User: ubuntu-de...@lists.ubuntu.com > > Usertags: origin-ubuntu ubuntu-patch > > Control: tag -1 patch > > > > Hi, debian/rules does not install various udev rules, and some of the > > udev rules are broken. Also debian/rules does not properly run dh_clean > > at the end of the clean target. > > > > I prepared a branch for you: > > > > pull https://git.launchpad.net/~juliank/+git/multipath-tools-debian > > rules-fixes > > > > with the following changes: > > > > Julian Andres Klode (6): > > Install dm-parts.rule > > Fix /usr/lib/udev to be /lib/udev > > Move udev rules at position 11 to position 56 > > Fix 11-dm-mpath.rules to check for DM_UDEV_RULES, not > > DM_UDEV_RULES_VSN > > d/rules: Run dh_clean from clean target > > Install 68-del-part-nodes.rules > > I pushed another fix from the upstream mailing list that makes the tgt... > autopkgtest pass.
Attaching the patches for more convenience. You probably also need to update your initramfs integration to install the new udev rules, we have our own in Ubuntu. Hope it's useful. -- debian developer - deb.li/jak | jak-linux.org - free software dev ubuntu core developer i speak de, en
>From a57a3f6fb1e4ecd25d31110bb71efac5b8806071 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:29:33 +0100 Subject: [PATCH 1/7] Install dm-parts.rule This requires some changes in the debian/rules files, because the use of dh_udev is somewhat broken. --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index eb22b316..fd2e4148 100755 --- a/debian/rules +++ b/debian/rules @@ -29,6 +29,7 @@ build-indep: build-stamp: clean-tree dh_testdir + [ ! -f kpartx/dm-parts.rules ] || cp kpartx/dm-parts.rules debian/kpartx.dm-parts.udev [ ! -f kpartx/kpartx.rules ] || cp kpartx/kpartx.rules debian/kpartx.udev [ ! -f multipath/multipath.rules ] || cp multipath/multipath.rules debian/multipath.udev [ ! -f multipath/11-dm-mpath.rules ] || cp multipath/11-dm-mpath.rules debian/dm-mpath.udev @@ -123,6 +124,7 @@ binary-arch: build install dh_systemd_enable -pmultipath-tools multipathd.service dh_installinit -pmultipath-tools dh_installudev -pkpartx + dh_installudev -pkpartx --name=dm-parts --priority=11 dh_installudev -pmultipath-tools --name=multipath dh_installudev -pmultipath-tools --name=dm-mpath --priority=11 dh_link -a lib/systemd/system/multipathd.service \ -- 2.15.1
>From 89ca2be13f253048918d3be7f4b89e32aec9dcec Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:29:43 +0100 Subject: [PATCH 2/7] Fix /usr/lib/udev to be /lib/udev Otherwise it does not find kpartx_id. --- debian/patches/fix-usrmerge-paths.patch | 11 +++++++++++ debian/patches/series | 1 + 2 files changed, 12 insertions(+) create mode 100644 debian/patches/fix-usrmerge-paths.patch diff --git a/debian/patches/fix-usrmerge-paths.patch b/debian/patches/fix-usrmerge-paths.patch new file mode 100644 index 00000000..a308193b --- /dev/null +++ b/debian/patches/fix-usrmerge-paths.patch @@ -0,0 +1,11 @@ +--- a/multipath/11-dm-mpath.rules ++++ b/multipath/11-dm-mpath.rules +@@ -97,7 +97,7 @@ ENV{DM_UDEV_LOW_PRIORITY_FLAG}!="1", OPT + + # kpartx_id is very robust, it works for suspended maps and maps + # with 0 dependencies. It sets DM_TYPE, DM_PART, DM_WWN +-TEST=="/usr/lib/udev/kpartx_id", \ ++TEST=="/lib/udev/kpartx_id", \ + IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}" + + ENV{DM_TYPE}=="?*", SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}" diff --git a/debian/patches/series b/debian/patches/series index cc0c6d8f..dc2cd61c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ systemd-alias.patch disable-systemd-for-udeb.patch disable-rados-link-for-udeb-new.patch +fix-usrmerge-paths.patch -- 2.15.1
>From fcf178ab8c99af37119c3a3c325032df890ec0db Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:30:43 +0100 Subject: [PATCH 3/7] Move udev rules at position 11 to position 56 Some of them, like dm-mpath rely on dm.rules. Upstream, dm.rules is installed at 10, but we install it at 55, so we have to move dm-mpath.rules from 11 to 56. Adjusting dm-parts.rules is mostly for consistency. --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index fd2e4148..3cfa67d3 100755 --- a/debian/rules +++ b/debian/rules @@ -124,9 +124,9 @@ binary-arch: build install dh_systemd_enable -pmultipath-tools multipathd.service dh_installinit -pmultipath-tools dh_installudev -pkpartx - dh_installudev -pkpartx --name=dm-parts --priority=11 + dh_installudev -pkpartx --name=dm-parts --priority=56 dh_installudev -pmultipath-tools --name=multipath - dh_installudev -pmultipath-tools --name=dm-mpath --priority=11 + dh_installudev -pmultipath-tools --name=dm-mpath --priority=56 dh_link -a lib/systemd/system/multipathd.service \ lib/systemd/system/multipath-tools.service dh_systemd_start -pmultipath-tools multipathd.service -- 2.15.1
>From 9c5718de1100fbabcefb8384f5c27fd12133c828 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:31:01 +0100 Subject: [PATCH 4/7] Fix 11-dm-mpath.rules to check for DM_UDEV_RULES, not DM_UDEV_RULES_VSN We patch that in lvm2 to be named differently for who knows why. --- debian/patches/11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch | 9 +++++++++ debian/patches/series | 1 + 2 files changed, 10 insertions(+) create mode 100644 debian/patches/11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch diff --git a/debian/patches/11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch b/debian/patches/11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch new file mode 100644 index 00000000..c37882ff --- /dev/null +++ b/debian/patches/11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch @@ -0,0 +1,9 @@ +--- a/multipath/11-dm-mpath.rules ++++ b/multipath/11-dm-mpath.rules +@@ -1,5 +1,5 @@ + ACTION!="add|change", GOTO="mpath_end" +-ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end" ++ENV{DM_UDEV_RULES}!="?*", GOTO="mpath_end" + ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end" + + IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" diff --git a/debian/patches/series b/debian/patches/series index dc2cd61c..f93c8da1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,3 +7,4 @@ systemd-alias.patch disable-systemd-for-udeb.patch disable-rados-link-for-udeb-new.patch fix-usrmerge-paths.patch +11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch -- 2.15.1
>From dc4d4b5ba41debcb3d0903abdf543e346c970c02 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:31:15 +0100 Subject: [PATCH 5/7] d/rules: Run dh_clean from clean target The clean target should run dh_clean as the last command. --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 3cfa67d3..bb5a1f8e 100755 --- a/debian/rules +++ b/debian/rules @@ -60,6 +60,7 @@ clean: clean-tree debconf-updatepo rm -rf debian/*.debhelper.log rm -rf debian/tmp-multipath-udeb + dh_clean install-indep: dh_testdir -- 2.15.1
>From 8d356b518269677d7a05c825d37b7fcdd3473071 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Wed, 10 Jan 2018 13:48:11 +0100 Subject: [PATCH 6/7] Install 68-del-part-nodes.rules --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index bb5a1f8e..21949362 100755 --- a/debian/rules +++ b/debian/rules @@ -29,6 +29,7 @@ build-indep: build-stamp: clean-tree dh_testdir + [ ! -f kpartx/del-part-nodes.rules ] || cp kpartx/dm-parts.rules debian/kpartx.del-part-nodes.udev [ ! -f kpartx/dm-parts.rules ] || cp kpartx/dm-parts.rules debian/kpartx.dm-parts.udev [ ! -f kpartx/kpartx.rules ] || cp kpartx/kpartx.rules debian/kpartx.udev [ ! -f multipath/multipath.rules ] || cp multipath/multipath.rules debian/multipath.udev @@ -126,6 +127,7 @@ binary-arch: build install dh_installinit -pmultipath-tools dh_installudev -pkpartx dh_installudev -pkpartx --name=dm-parts --priority=56 + dh_installudev -pkpartx --name=del-part-nodes --priority=68 dh_installudev -pmultipath-tools --name=multipath dh_installudev -pmultipath-tools --name=dm-mpath --priority=56 dh_link -a lib/systemd/system/multipathd.service \ -- 2.15.1
>From fee42e2d664a1619cabc898d47822036587b7a2f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <julian.kl...@canonical.com> Date: Mon, 15 Jan 2018 12:12:52 +0100 Subject: [PATCH 7/7] Import upstream commit to fix crash in multipathd This fixes a crash in multipathd when removing a device that has already been removed. --- ...ools-check-null-path-before-handle-path-f.patch | 48 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 debian/patches/0001-multipath-tools-check-null-path-before-handle-path-f.patch diff --git a/debian/patches/0001-multipath-tools-check-null-path-before-handle-path-f.patch b/debian/patches/0001-multipath-tools-check-null-path-before-handle-path-f.patch new file mode 100644 index 00000000..5cd252d9 --- /dev/null +++ b/debian/patches/0001-multipath-tools-check-null-path-before-handle-path-f.patch @@ -0,0 +1,48 @@ +From 83924318b419fa2ac25e3eb90a5eb59c9c467666 Mon Sep 17 00:00:00 2001 +From: Guan Junxiong <guanjunxi...@huawei.com> +Date: Mon, 4 Dec 2017 21:15:50 +0800 +Subject: [PATCH] multipath-tools: check null path before handle path-failed + event + +In the hot-plug storage OS, if we tear down the target storage, +there is a race between the path removing from the path list and +handling the path-failed udev event. Therefore, we need to check +null path before handle path-failed event. + +Signed-off-by: Guan Junxiong <guanjunxi...@huawei.com> +--- + multipathd/main.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -1073,7 +1073,7 @@ uev_pathfail_check(struct uevent *uev, s + { + char *action = NULL, *devt = NULL; + struct path *pp; +- int r; ++ int r = 1; + + action = uevent_get_dm_action(uev); + if (!action) +@@ -1090,15 +1090,17 @@ uev_pathfail_check(struct uevent *uev, s + lock(&vecs->lock); + pthread_testcancel(); + pp = find_path_by_devt(vecs->pathvec, devt); ++ if (!pp) ++ goto out_lock; + r = io_err_stat_handle_pathfail(pp); +- lock_cleanup_pop(vecs->lock); +- + if (r) + condlog(3, "io_err_stat: %s: cannot handle pathfail uevent", + pp->dev); ++out_lock: ++ lock_cleanup_pop(vecs->lock); + FREE(devt); + FREE(action); +- return 0; ++ return r; + out: + FREE(action); + return 1; diff --git a/debian/patches/series b/debian/patches/series index f93c8da1..de59d07c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,3 +8,4 @@ disable-systemd-for-udeb.patch disable-rados-link-for-udeb-new.patch fix-usrmerge-paths.patch 11-dm-mpath-fix-DM_UDEV_RULES_VSN-check.patch +0001-multipath-tools-check-null-path-before-handle-path-f.patch -- 2.15.1