Remove dependency on multipathd.socket to fix initrd hanging before switching root.

Previous committed patch is a temporary solution.
Now synchronize the patch change from upstream.
This commit is contained in:
Jiayi Chen 2023-04-08 13:41:08 +08:00
parent 3f25b19100
commit 5459b7ed70
3 changed files with 49 additions and 46 deletions

View File

@ -1,44 +0,0 @@
From 4b6b72a87f0ee2d8e83209a5ceb9862ccd80c33e Mon Sep 17 00:00:00 2001
From: Tianhao Chai <cth451@gmail.com>
Date: Sat, 25 Mar 2023 16:58:35 -0400
Subject: [PATCH] fix(multipath): enable service but disable socket
This fixes #2289, #2175 where in the cleanup hook running multipath
binary triggers activation of multipathd.service after it is stopped
as dracut prepares to switch root in initrd-cleanup.service.
An earlier fix from PR #2010 was based on an old systemd behavior where
missing socket will prevent the service from being enabled. This does
not seem to be the case anymore. For completeness, I'm disabling the
socket alone after enabling service.
At the end of the day we should probably remove `Also=multipathd.socket`
from `multipathd.service` and upsteam this change. The whole point of
having a socket enabled separately from the service is that systemd can
start the service as-needed. Binding enable/disable status together
would not be very sane.
Reference:https://github.com/dracutdevs/dracut/pull/2290/commits/4b6b72a87f0ee2d8e83209a5ceb9862ccd80c33e
Conflict:NA
---
modules.d/90multipath/module-setup.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 370cab9..707d6b9 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -139,7 +139,10 @@ install() {
fi
inst_simple "${systemdsystemunitdir}/multipathd.socket"
inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
+ # Enables service and the socket, but...
$SYSTEMCTL -q --root "$initdir" enable multipathd.service
+ # the socket hangs initrd-cleanup (see #2289).
+ $SYSTEMCTL -q --root "$initdir" disable multipathd.socket
else
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
--
2.33.0

View File

@ -0,0 +1,44 @@
From 71696ec83fce0b20a3cf489b970a200e44227d78 Mon Sep 17 00:00:00 2001
From: Tianhao Chai <cth451@gmail.com>
Date: Mon, 10 Apr 2023 20:36:12 -0400
Subject: [PATCH] fix(multipath): remove dependency on multipathd.socket
This reverts commit e39ff407eca1d783ab44093c44db5ee401ff5b1d, removes
an incorrect `Also=` directive from multipathd.service.
`Also=multipathd.socket` is not the correct behavior for a
socket-activated service. This directive has been removed upstream
and dracut should do the same.
This fixes #2289, #2175 where in the cleanup hook running multipath
binary triggers activation of multipathd.service after it is stopped
as dracut prepares to switch root in initrd-cleanup.service.
Reference:https://github.com/dracutdevs/dracut/pull/2290/commits/71696ec83fce0b20a3cf489b970a200e44227d78
Conflict:NA
---
modules.d/90multipath/module-setup.sh | 1 -
modules.d/90multipath/multipathd.service | 1 -
2 files changed, 2 deletions(-)
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 370cab92b..9c3e6295f 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -137,7 +137,6 @@ install() {
inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service"
$SYSTEMCTL -q --root "$initdir" enable multipathd-configure.service
fi
- inst_simple "${systemdsystemunitdir}/multipathd.socket"
inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
$SYSTEMCTL -q --root "$initdir" enable multipathd.service
else
diff --git a/modules.d/90multipath/multipathd.service b/modules.d/90multipath/multipathd.service
index e8182533d..1680cdfb3 100644
--- a/modules.d/90multipath/multipathd.service
+++ b/modules.d/90multipath/multipathd.service
@@ -25,4 +25,3 @@ TasksMax=infinity
[Install]
WantedBy=sysinit.target
-Also=multipathd.socket

View File

@ -9,7 +9,7 @@
Name: dracut Name: dracut
Version: 059 Version: 059
Release: 2 Release: 3
Summary: Initramfs generator using udev Summary: Initramfs generator using udev
@ -31,7 +31,7 @@ Patch4: add-option-to-include-file-metadata-in-initramfs.patch
Patch5: revert-fix-systemd-networkd-make-systemd-networkd.patch Patch5: revert-fix-systemd-networkd-make-systemd-networkd.patch
Patch6: make-network-legacy-instead-of-network-manager-the-network.patch Patch6: make-network-legacy-instead-of-network-manager-the-network.patch
Patch7: bring-back-51-dracut-rescue-postinst.sh.patch Patch7: bring-back-51-dracut-rescue-postinst.sh.patch
Patch8: backport-fix-multipath-enable-service-but-disable-socket.patch Patch8: backport-fix-multipath-remove-dependency-on-multipathd-socket.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
Source2: openEuler.conf.example Source2: openEuler.conf.example
@ -520,6 +520,9 @@ rm -f 51-dracut-rescue-postinst.sh
%endif %endif
%changelog %changelog
* Tue Apr 11 2023 Jiayi Chen <chenjiayi22@huawei.com> - 059-3
- remove dependency on multipathd.socket to fix initrd hanging
* Mon Mar 27 2023 Jiayi Chen <chenjiayi22@huawei.com> - 059-2 * Mon Mar 27 2023 Jiayi Chen <chenjiayi22@huawei.com> - 059-2
- fix the problem that initrd is blocked by multipathd - fix the problem that initrd is blocked by multipathd