-
--- 0.8.5-1/debian/initramfs/local-top 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/local-top 1970-01-01 00:00:00.000000000 +0000
@@ -1,60 +0,0 @@
-#!/bin/sh
-#
-# multipath discovery
-
-PREREQ="udev iscsi"
-
-prereqs() { echo "$PREREQ"; }
-
-case $1 in
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-. /scripts/functions
-
-verbose()
-{
- case "$quiet" in y*|Y*|1|t*|T*)
- return 1;;
- *)
- return 0;;
- esac
-}
-
-maybe_break pre-multipath
-VERBOSITY=0
-MP_MODULES="scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath"
-
-if [ ! -e /sbin/multipath ]; then
- exit 0
-fi
-
-verbose && log_begin_msg "Loading multipath modules"
-for module in ${MP_MODULES}; do
- if modprobe "$module"; then
- verbose && log_success_msg "loaded module ${module}."
- else
- log_failure_msg "failed to load module ${module}."
- fi
-done
-verbose && log_end_msg
-
-verbose && log_begin_msg "Discovering multipaths"
-/sbin/multipath -v $VERBOSITY
-verbose && log_end_msg
-
-if [ -x /sbin/kpartx -a -x /sbin/dmsetup ]; then
- /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p -part" >/dev/null
-fi
-
-if [ -x /bin/udevadm ]; then
- /bin/udevadm settle --timeout=10
-fi
-
-maybe_break post-multipath
-
-exit 0
-
-
--- 0.8.5-1/debian/initramfs/local-bottom 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/local-bottom 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# multipathd shutdown
+
+PREREQ=""
+
+prereqs() { echo "$PREREQ"; }
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+
+verbose()
+{
+ case "$quiet" in y*|Y*|1|t*|T*)
+ return 1;;
+ *)
+ return 0;;
+ esac
+}
+
+maybe_break pre-multipath
+
+if [ ! -e /sbin/multipathd ]; then
+ exit 0
+fi
+
+# Stop multipathd
+verbose && log_begin_msg "Stopping multipathd"
+
+pid_pidof="$(pidof multipathd)"
+pid_file="$(cat /run/multipathd.pid)"
+
+if [ "${pid_pidof}" = "${pid_file}" ]; then
+ kill ${pid_pidof}
+ verbose && log_end_msg
+else
+ verbose && log_failure_msg "inconsistent PIDs (pidof: '${pid_pidof}', multipathd.pid: '${pid_file}')"
+fi
+
+# Wait for multipathd unix socket to close.
+# It might take a while for multipathd to handle the signal,
+# which might leave the unix socket open until the upcoming
+# systemd multipath.socket unit starts. Then it fails with
+# (Result: resources) like this (logs in journalctl):
+# "Failed to listen on sockets: Address already in use"
+seconds=10
+while [ $seconds -gt 0 ]; do
+ grep -q '@/org/kernel/linux/storage/multipathd' /proc/net/unix || break
+ seconds=$((seconds - 1))
+ sleep 1
+done
+
+maybe_break post-multipath
+
+exit 0
+
-
--- 0.8.5-1/debian/kpartx-boot.postrm 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/kpartx-boot.postrm 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,45 @@
+#!/bin/sh
+# postrm script for kpartx-boot
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove)
+ if [ -x /usr/sbin/update-initramfs -a -e /etc/initramfs-tools/initramfs.conf ]; then
+ update-initramfs -u
+ fi
+ ;;
+
+ purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
-
--- 0.8.5-1/debian/multipath-tools.dm-mpath-lvm.udev 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/multipath-tools.dm-mpath-lvm.udev 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,26 @@
+# An individual device may be part of a multipath device.
+# In such case, remove its partition device nodes so for
+# LVM to scan/lock/use only the multipath device.
+# - Check it on 'add' uevent.
+# - Check it on 'change' uevent (it may change).
+
+SUBSYSTEM!="block", \
+ GOTO="end_mpath"
+
+ACTION=="remove", \
+ GOTO="end_mpath"
+
+ENV{DEVTYPE}=="partition", \
+ IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH", \
+ GOTO="end_mpath"
+
+PROGRAM=="/sbin/multipath -u $devnode", \
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1", \
+ ENV{ID_FS_TYPE}="mpath_member", \
+ RUN+="/usr/bin/partx -d --nr 1-1024 $devnode", \
+ GOTO="end_mpath"
+
+# Not part of a multipath device.
+ENV{DM_MULTIPATH_DEVICE_PATH}=""
+
+LABEL="end_mpath"
-
--- 0.8.5-1/debian/rules 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/rules 2020-12-24 02:46:31.000000000 +0000
@@ -2,6 +2,13 @@
INITRAMFS=$(CURDIR)/debian/multipath-tools-boot/usr/share/initramfs-tools/
+ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),i386)
+ ADD_UDEB = --no-add-udeb
+ skip_packages = -Nmultipath-tools
+else
+ ADD_UDEB = --add-udeb=multipath-udeb
+endif
+
# For Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
@@ -37,7 +44,7 @@ build-stamp: clean-tree
build-multipath-udeb-stamp:
dh_testdir
- DEB_CFLAGS_MAINT_APPEND="-static-libgcc" dh_auto_build --parallel -- $(OPTFLAGS) LIB=/lib USE_SYSTEMD=0
+ DEB_CFLAGS_MAINT_APPEND="-static-libgcc" CFLAGS_DISABLE_FEXCEPTIONS=1 dh_auto_build --parallel -- $(OPTFLAGS) LIB=/lib USE_SYSTEMD=0
# store files for install target
mkdir -p $(CURDIR)/debian/tmp-multipath-udeb/sbin
@@ -65,8 +72,11 @@ install-indep:
# initramfs stuff:
install -D -m 755 debian/initramfs/hooks $(INITRAMFS)/hooks/multipath
- install -D -m 755 debian/initramfs/local-top \
- $(INITRAMFS)/scripts/local-top/multipath
+ install -D -m 755 debian/initramfs/kpartx.hook $(CURDIR)/debian/kpartx-boot/usr/share/initramfs-tools/hooks/kpartx
+ install -D -m 755 debian/initramfs/local-premount \
+ $(INITRAMFS)/scripts/local-premount/multipath
+ install -D -m 755 debian/initramfs/local-bottom \
+ $(INITRAMFS)/scripts/local-bottom/multipath
install -D -m 755 debian/initramfs/init-top \
$(INITRAMFS)/scripts/init-top/multipath
@@ -88,6 +98,8 @@ install: install-indep
mkdir -p $(CURDIR)/debian/tmp/sbin
$(MAKE) -j1 install DESTDIR=$(CURDIR)/debian/tmp LIB=/lib SYSTEMDPATH=/lib USE_SYSTEMD=1
install -m 755 debian/dmsetup_env $(CURDIR)/debian/tmp/lib/udev/
+ mkdir -p $(CURDIR)/debian/tmp/etc
+ cp debian/multipath.conf $(CURDIR)/debian/tmp/etc
dh_install -X.rules --fail-missing -Nmultipath-udeb --sourcedir=$(CURDIR)/debian/tmp
dh_install -Xkpartx_id -X.rules -X.service -X.socket --fail-missing -pmultipath-udeb --sourcedir=$(CURDIR)/debian/tmp-multipath-udeb
@@ -119,7 +131,7 @@ binary-arch: build install
dh_lintian -a
dh_systemd_enable -pmultipath-tools multipathd.service
dh_installinit -pmultipath-tools
- dh_installudev -pkpartx
+ dh_installudev -pkpartx --priority=95
dh_installudev -pkpartx --name=dm-parts --priority=56
dh_installudev -pkpartx --name=del-part-nodes --priority=68
dh_installudev -pmultipath-tools --name=multipath
@@ -128,16 +140,16 @@ binary-arch: build install
lib/systemd/system/multipath-tools.service
dh_systemd_start -pmultipath-tools multipathd.service
dh_installman -a
- dh_makeshlibs -a --add-udeb=multipath-udeb
+ dh_makeshlibs -a $(ADD_UDEB)
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_installdeb -a
dh_shlibdeps -a
- dh_gencontrol -a
+ dh_gencontrol -a $(skip_packages)
dh_md5sums -a
- dh_builddeb -a
+ dh_builddeb -a $(skip_packages)
binary: binary-indep binary-arch
.PHONY: binary binary-arch binary-indep unpack configure build clean
-
--- 0.8.5-1/debian/multipath-tools.install 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/multipath-tools.install 2020-12-24 02:46:31.000000000 +0000
@@ -14,3 +14,4 @@
/usr/include/libdmmp/libdmmp.h
/lib/systemd/system/multipathd.service
/lib/systemd/system/multipathd.socket
+/etc/multipath.conf
-
--- 0.8.5-1/debian/control 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/control 2020-12-24 02:46:31.000000000 +0000
@@ -1,7 +1,8 @@
Source: multipath-tools
Section: admin
Priority: optional
-Maintainer: Debian DM Multipath Team <team+linux-blocks@tracker.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian DM Multipath Team <team+linux-blocks@tracker.debian.org>
Uploaders: Guido Günther <agx@sigxcpu.org>, Ritesh Raj Sarraf <rrs@debian.org>, Chris Hofstaedtler <zeha@debian.org>
Build-Depends: debhelper-compat (= 9), po-debconf, libdevmapper-dev, libreadline-dev, libaio-dev, libudev-dev, libsystemd-dev, systemd, liburcu-dev, pkg-config, libjson-c-dev
Vcs-Git: https://salsa.debian.org/linux-blocks-team/multipath-tools.git
@@ -30,10 +31,18 @@ Description: create device mappings for
It is part of the Linux multipath-tools, but is useful on any
device-mapper using system.
+Package: kpartx-boot
+Architecture: all
+Depends: ${misc:Depends}, initramfs-tools,
+ kpartx (>= ${source:Version}), kpartx (<< ${source:Version}.1~)
+Description: Provides kpartx during boot
+ This package makes kpartx available during boot to activate partitions
+
Package: multipath-tools-boot
Architecture: all
Depends: ${misc:Depends}, initramfs-tools | linux-initramfs-tool, lsb-base,
- multipath-tools (>= ${source:Version}), multipath-tools (<< ${source:Version}.1~)
+ multipath-tools (>= ${source:Version}), multipath-tools (<< ${source:Version}.1~),
+ kpartx-boot (= ${binary:Version})
Description: Support booting from multipath devices
This package contains the necessary support for booting from a multipath
device:
@@ -46,8 +55,8 @@ Description: Support booting from multip
Package: multipath-udeb
Package-Type: udeb
-Architecture: linux-any
-Depends: ${shlibs:Depends}, ${misc:Depends}, multipath-modules, kpartx-udeb
+Architecture: amd64 arm64 armhf ppc64el riscv64 s390x
+Depends: ${shlibs:Depends}, ${misc:Depends}, multipath-modules, kpartx-udeb, sg3-udeb
Section: debian-installer
Description: maintain multipath block device access - udeb package
This is a udeb, or a microdeb, for the debian-installer.
@@ -57,7 +66,7 @@ Description: maintain multipath block de
Package: kpartx-udeb
Package-Type: udeb
-Architecture: linux-any
+Architecture: amd64 arm64 armhf ppc64el riscv64 s390x
Depends: ${shlibs:Depends}, ${misc:Depends}
Section: debian-installer
Description: create device mappings for partitions - udeb package
-
--- 0.8.5-1/debian/tests/tgtbasedmpaths 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/tests/tgtbasedmpaths 2020-12-24 02:46:31.000000000 +0000
@@ -15,8 +15,8 @@ localhost="127.0.0.1"
portal="${localhost}:3260"
maxpaths=4
backfn="backingfile"
-expectwwid="360000000000000000e00000000010001"
-testdisk="/dev/disk/by-id/scsi-${expectwwid}"
+expectwwid="60000000000000000e00000000010001"
+testdisk="/dev/disk/by-id/wwn-0x${expectwwid}"
bglog="$AUTOPKGTEST_ARTIFACTS/test-background.log"
fioprep="$AUTOPKGTEST_ARTIFACTS/path-change-prep.fio"
fiovrfy="$AUTOPKGTEST_ARTIFACTS/path-change-check.fio"
@@ -48,6 +48,7 @@ do
done
udevadm settle
+sleep 5 # sleep a bit to allow device to be created....
# status summary
echo "Status after initial setup"
-
--- 0.8.5-1/debian/patches/kpartx-Improve-finding-loopback-device-by-file.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/kpartx-Improve-finding-loopback-device-by-file.patch 2020-12-25 21:51:24.000000000 +0000
@@ -0,0 +1,74 @@
+From f2bd34f273a02c0ed12e996ebe57211576e40fa6 Mon Sep 17 00:00:00 2001
+From: Julian Andres Klode <julian.klode@canonical.com>
+Date: Mon, 5 Feb 2018 09:44:36 +0100
+Subject: [PATCH] kpartx: Improve finding loopback device by file
+
+Commit 9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b changed kpartx
+to lookup files by absolute path, using realpath(). This introduced
+a regression when part of the filename where symbolic links. While
+the kernel stores the absolute path to the backing file, it does not
+resolve symbolic links, and hence kpartx would fail to find the loopback
+device because it resolves symbolic links when deleting.
+
+This introduces two workarounds in find_loop_by_file()
+
+(1) We match against the specified file name as is as well
+(2) We canonicalize the loopinfo.lo_name and match the canonicalized filename
+ against that.
+
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/1747044
+Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
+Forwarded: https://www.redhat.com/archives/dm-devel/2018-February/msg00019.html
+---
+ kpartx/kpartx.c | 8 +-------
+ kpartx/lopart.c | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 8 deletions(-)
+
+Index: multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+===================================================================
+--- multipath-tools-0.8.5-1ubuntu1.orig/kpartx/kpartx.c
++++ multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+@@ -350,10 +350,10 @@
+ char rpath[PATH_MAX];
+ if (realpath(device, rpath) == NULL) {
+ fprintf(stderr, "Error: %s: %s\n", device,
+- strerror(errno));
++ strerror(errno));
+ exit (1);
+ }
+- loopdev = find_loop_by_file(rpath);
++ loopdev = find_loop_by_file(device);
+
+ if (!loopdev && what == DELETE)
+ exit (0);
+Index: multipath-tools-0.8.5-1ubuntu1/kpartx/lopart.c
+===================================================================
+--- multipath-tools-0.8.5-1ubuntu1.orig/kpartx/lopart.c
++++ multipath-tools-0.8.5-1ubuntu1/kpartx/lopart.c
+@@ -69,6 +69,14 @@
+ struct loop_info loopinfo;
+ const char VIRT_BLOCK[] = "/sys/devices/virtual/block";
+ char path[PATH_MAX];
++ char rfilename[PATH_MAX];
++ char rloopfilename[PATH_MAX];
++ if (realpath(filename, rfilename) == NULL) {
++ fprintf(stderr, "Error: %s: %s\n", filename,
++ strerror(errno));
++ exit (1);
++ }
++
+ char bf_path[PATH_MAX];
+ char backing_file[PATH_MAX];
+
+@@ -120,7 +128,10 @@
+
+ close (fd);
+
+- if (0 == strcmp(filename, loopinfo.lo_name)) {
++ if (0 == strcmp(filename, loopinfo.lo_name) ||
++ 0 == strcmp(rfilename, loopinfo.lo_name) ||
++ (realpath(loopinfo.lo_name, rloopfilename) &&
++ 0 == strcmp(rfilename, rloopfilename))) {
+ found = realpath(path, NULL);
+ break;
+ }
-
--- 0.8.5-1/debian/patches/disable-fexceptions-udeb.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/disable-fexceptions-udeb.patch 2020-12-25 21:51:18.000000000 +0000
@@ -0,0 +1,19 @@
+From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
+Subject: Make the use of -fexceptions conditional.
+Last-Update: 2019-04-29
+
+Index: multipath-tools-0.8.5-1ubuntu1/Makefile.inc
+===================================================================
+--- multipath-tools-0.8.5-1ubuntu1.orig/Makefile.inc
++++ multipath-tools-0.8.5-1ubuntu1/Makefile.inc
+@@ -107,6 +107,10 @@
+ LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now
+ BIN_LDFLAGS = -pie
+
++ifdef CFLAGS_DISABLE_FEXCEPTIONS
++ CFLAGS := $(filter-out -fexceptions,$(CFLAGS))
++endif
++
+ # Check whether a function with name $1 has been declared in header file $2.
+ check_func = $(shell \
+ if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
-
--- 0.8.5-1/debian/multipath-udeb.install 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/multipath-udeb.install 2020-12-24 02:46:31.000000000 +0000
@@ -2,3 +2,4 @@
/lib/multipath/
/lib/libmultipath.so.*
/lib/libmpathcmd.so*
+/etc/multipath.conf
\ No newline at end of file
-
--- 0.8.5-1/debian/kpartx-boot.postinst 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/kpartx-boot.postinst 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,34 @@
+#!/bin/sh
+# postinst script for kpartx-boot
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+case "$1" in
+ configure)
+ if [ -x /usr/sbin/update-initramfs -a -e /etc/initramfs-tools/initramfs.conf ]; then
+ update-initramfs -u
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
-
--- 0.8.5-1/debian/patches/kpartx-print-loop-deleted-to-stdout-not-stderr.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/kpartx-print-loop-deleted-to-stdout-not-stderr.patch 2020-12-25 21:51:25.000000000 +0000
@@ -0,0 +1,30 @@
+From dc2cd8f1c7d910d98e2046fd096a5eb67a8e9b9a Mon Sep 17 00:00:00 2001
+From: Julian Andres Klode <julian.klode@canonical.com>
+Date: Mon, 5 Feb 2018 11:34:14 +0100
+Subject: [PATCH] kpartx: print "loop deleted" to stdout, not stderr
+
+Commit fa643f5d2590028a59c671b81ab41383806fd258 moved some
+code around and changed the print for loop deleted from stdout
+to stderr - but this is not an error message, and also printed
+to stdout in another place, so let's just use printf() again
+here.
+
+Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
+Forwarded: https://www.redhat.com/archives/dm-devel/2018-February/msg00021.html
+---
+ kpartx/kpartx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+===================================================================
+--- multipath-tools-0.8.5-1ubuntu1.orig/kpartx/kpartx.c
++++ multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+@@ -425,7 +425,7 @@
+ loopdev);
+ r = 1;
+ } else
+- fprintf(stderr, "loop deleted : %s\n", loopdev);
++ printf("loop deleted : %s\n", loopdev);
+ }
+ goto end;
+ }
-
--- 0.8.5-1/debian/multipath.conf 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/multipath.conf 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,3 @@
+defaults {
+ user_friendly_names yes
+}
-
--- 0.8.5-1/debian/patches/series 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/series 2020-12-25 21:51:10.000000000 +0000
@@ -1,3 +1,9 @@
+disable-fexceptions-udeb.patch
+kpartx_more_loopback_fixes.patch
+enable-find-multipaths.patch
+kpartx-Improve-finding-loopback-device-by-file.patch
+kpartx-print-loop-deleted-to-stdout-not-stderr.patch
+no-start-in-containers.patch
0002-Update-build-flags.patch
0003-kpartx-udev-hack-in-dmsetup_env.patch
0004-systemd-alias-multipath-service.patch
-
--- 0.8.5-1/debian/patches/no-start-in-containers.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/no-start-in-containers.patch 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,17 @@
+Description: Do not attempt to start multipath-tools in containers,
+ should switch for on-demand udev/socket based activation in the
+ future.
+Author: Dimitri John Ledkov <xnox@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1823093
+
+
+--- multipath-tools-0.7.4.orig/multipathd/multipathd.service
++++ multipath-tools-0.7.4/multipathd/multipathd.service
+@@ -8,6 +8,7 @@ DefaultDependencies=no
+ Conflicts=shutdown.target
+ ConditionKernelCommandLine=!nompath
+ ConditionKernelCommandLine=!multipath=off
++ConditionVirtualization=!container
+
+ [Service]
+ Type=notify
-
--- 0.8.5-1/debian/kpartx.install 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/kpartx.install 2020-12-24 02:46:31.000000000 +0000
@@ -1,4 +1,4 @@
/usr/share/man/man8/kpartx.8.gz
/sbin/kpartx
-/lib/udev/kpartx_id
-/lib/udev/dmsetup_env
+/lib*/udev/kpartx_id
+/lib*/udev/dmsetup_env
-
--- 0.8.5-1/debian/initramfs/kpartx.hook 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/kpartx.hook 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+PREREQS="udev"
+
+prereqs() { echo "$PREREQS"; }
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /sbin/kpartx /sbin
+copy_exec /sbin/dmsetup /sbin
+copy_exec /lib/udev/dmsetup_env /lib/udev
+copy_exec /lib/udev/kpartx_id /lib/udev
+cp -p /lib/udev/rules.d/56-dm-parts.rules $DESTDIR/lib/udev/rules.d/
+cp -p /lib/udev/rules.d/68-del-part-nodes.rules $DESTDIR/lib/udev/rules.d/
+cp -p /lib/udev/rules.d/95-kpartx.rules $DESTDIR/lib/udev/rules.d/
-
--- 0.8.5-1/debian/patches/newer-jsonc.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/newer-jsonc.patch 2020-07-31 23:10:37.000000000 +0000
@@ -0,0 +1,22 @@
+Description: Patch to make it build with newer json-c deprecated TRUE/FALSE defines
+
+Author: Gianfranco Costamagna <locutusofborg@debian.org>
+Last-Update: 2020-07-31
+
+--- multipath-tools-0.8.4.orig/libdmmp/libdmmp_private.h
++++ multipath-tools-0.8.4/libdmmp/libdmmp_private.h
+@@ -32,6 +32,14 @@
+ #include <assert.h>
+ #include <json.h>
+
++// not exported anymore by new json-c
++#ifndef TRUE
++#define TRUE 1
++#endif
++#ifndef FALSE
++#define FALSE 0
++#endif
++
+ #include "libdmmp/libdmmp.h"
+
+ #ifdef __cplusplus
-
--- 0.8.5-1/debian/initramfs/init-top 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/init-top 2020-12-24 02:46:31.000000000 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# multipath hardware handler
+# multipath: load modules and daemon
PREREQ=" "
@@ -26,7 +26,18 @@ verbose()
maybe_break pre-multipath
VERBOSITY=0
-HW_HANDLERS=""
+HW_HANDLERS="scsi_dh_alua scsi_dh_rdac scsi_dh_emc"
+MP_MODULES="dm-multipath"
+
+verbose && log_begin_msg "Loading multipath modules"
+for module in ${MP_MODULES}; do
+ if modprobe --syslog "$module"; then
+ verbose && log_success_msg "loaded module ${module}."
+ else
+ log_failure_msg "failed to load module ${module}."
+ fi
+done
+verbose && log_end_msg
verbose && log_begin_msg "Loading multipath hardware handlers"
for module in ${HW_HANDLERS}; do
@@ -38,6 +49,11 @@ for module in ${HW_HANDLERS}; do
done
verbose && log_end_msg
+# Start multipathd
+verbose && log_begin_msg "Starting multipathd"
+/sbin/multipathd -B
+verbose && log_end_msg
+
maybe_break post-multipath
exit 0
-
--- 0.8.5-1/debian/initramfs/local-premount 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/local-premount 2020-07-30 14:45:10.000000000 +0000
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+
+if [ -x /sbin/multipath ]
+then
+ [ "$quiet" != "y" ] && log_begin_msg "Waiting for udev to settle (multipath)"
+ udevadm settle --timeout=121 || true
+ [ "$quiet" != "y" ] && log_end_msg
+fi
+
+multipath -r -v0 -B
+
+exit 0
-
--- 0.8.5-1/debian/initramfs/hooks 2020-12-23 23:53:53.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/initramfs/hooks 2020-12-24 02:46:31.000000000 +0000
@@ -30,9 +30,17 @@ add_bindings()
fi
}
+add_wwids()
+{
+ if [ -r /etc/multipath/wwids ]; then
+ mkdir -p $DESTDIR/etc/multipath
+ cp /etc/multipath/wwids $DESTDIR/etc/multipath
+ fi
+}
+
add_udev_rules()
{
- for rules in 60-multipath.rules 60-kpartx.rules; do
+ for rules in 60-multipath.rules 56-dm-mpath.rules; do
if [ -e /lib/udev/rules.d/$rules ]; then
cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
fi
@@ -48,12 +56,24 @@ mkdir -p $DESTDIR/lib/multipath/
for x in /lib/multipath/*; do
copy_exec $x /lib/multipath/
done
+copy_exec /usr/bin/partx
add_udev_rules
+copy_exec /sbin/multipathd /sbin
+# multipathd requires libgcc_s.so.1 (not handled by copy_exec() as it's dlopen()'ed).
+# hack: find libgcc_s.so.1 via ldconfig cache (dpkg-architecture pulls lots of deps).
+for x in $(ldconfig --print-cache | grep -o '/lib/.*/libgcc_s\.so\.1'); do
+ copy_exec $x $(dirname $x)
+done
+
+# multipathd requires /run/multipathd.pid
+mkdir -p $DESTDIR/run
+
[ -r /etc/multipath.conf ] && cp /etc/multipath.conf $DESTDIR/etc/
add_bindings
+add_wwids
-for x in dm-multipath dm-service-time dm-round-robin; do
+for x in dm-multipath dm-service-time dm-round-robin dm-queue-length; do
manual_add_modules ${x}
done
-
--- 0.8.5-1/debian/patches/enable-find-multipaths.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/enable-find-multipaths.patch 2020-08-31 01:13:01.000000000 +0000
@@ -0,0 +1,17 @@
+From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
+Date: Thu, 25 Jan 2018 12:02:55 +0100
+Subject: enable find multipaths
+
+Forwarded: no
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1463046
+--- a/libmultipath/defaults.h
++++ b/libmultipath/defaults.h
+@@ -22,7 +22,7 @@
+ #define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
+ #define DEFAULT_VERBOSITY 2
+ #define DEFAULT_REASSIGN_MAPS 0
+-#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_STRICT
++#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_ON
+ #define DEFAULT_FAST_IO_FAIL 5
+ #define DEFAULT_DEV_LOSS_TMO 600
+ #define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_ON
-
--- 0.8.5-1/debian/patches/kpartx_more_loopback_fixes.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.8.5-1ubuntu1/debian/patches/kpartx_more_loopback_fixes.patch 2020-12-25 21:51:21.000000000 +0000
@@ -0,0 +1,42 @@
+From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
+Subject: Fix kpartx some more to correctly remove loopback devices on delete.
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/1543430
+
+Loop devices get created when using kpartx with an image file, but should be
+removed afterwards when using kpartx -d. Unfortunately, the devmapper maps
+did get removed but not the losetup nodes behind it, which were still bound
+to the image file. This is because we re-stat the loop device once we've
+figured which one to use, since otherwise we wouldn't have major and minor
+numbers for a loopback file; yet we need those to create the devmapper maps
+reliably.
+
+Instead of checking if we're dealing with a regular type file (since after
+stat() we'd not have the S_ISREG check succeed since we stat()'ed a device),
+use the loopdev variable. It's equivalent to device but only set if we've been
+called to work on an image.
+
+*update*
+This got partially upstream with the following patch - maybe we can drop it now?:
+commit ed4c3119cc1d6bc6656cf84d1e9c1ab184d87814
+Author: Christian Kastner <ckk@kvr.at>
+Date: Wed Jul 13 19:23:02 2016 +0200
+ kpartx: Fix check whether to detach loop device
+
+
+---
+ kpartx/kpartx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+===================================================================
+--- multipath-tools-0.8.5-1ubuntu1.orig/kpartx/kpartx.c
++++ multipath-tools-0.8.5-1ubuntu1/kpartx/kpartx.c
+@@ -668,7 +668,7 @@
+ if (n > 0)
+ break;
+ }
+- if (what == LIST && loopcreated && S_ISREG (buf.st_mode)) {
++ if (what == LIST && loopcreated && loopdev) {
+ if (fd != -1)
+ close(fd);
+ if (del_loop(device)) {