From 560b996bdf30f6e16da821ff0dec521dfef4dd52 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 18 May 2021 10:55:21 -0400 Subject: [PATCH] coreos-boot-mount-generator: Always use mpath for /boot if for root If root is on multipath, then we *know* we must use it for `/boot`. The current code is I believe racy because at the time the generator runs, we're querying the current properties of the device at `/dev/disk/by-label/boot`. But multipathd could still be in the process of setting up and replacing what that symlink points to. https://bugzilla.redhat.com/show_bug.cgi?id=1944660 --- .../coreos-boot-mount-generator | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator b/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator index ec2d059d77..cf4518c0aa 100755 --- a/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator +++ b/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator @@ -41,21 +41,12 @@ add_wants() { # is backed by a device-mapper target the dev-mapper.*.device is used. mk_mount() { local mount_pt="${1}"; shift - local label="${1}"; shift + local path="${1}"; shift local options="${1}"; shift - local path="/dev/disk/by-label/${label}" + local devservice=$(systemd-escape -p ${path} --suffix=service) local unit_name=$(systemd-escape -p ${mount_pt} --suffix=mount) - eval $(udevadm info --query property --export "${path}") - device="$(systemd-escape ${path})" - if [ "${DM_NAME:-x}" != "x" ]; then - path="/dev/mapper/${DM_NAME}" - device="$(systemd-escape dev/mapper/${DM_NAME})" - fi - device="${device//-dev/dev}" - echo "coreos-boot-mount-generator: using ${device} for ${label} mount to ${mount_pt}" - cat > "${UNIT_DIR}/${unit_name}" <