!510 fix /boot unmounted issue when the device is suspended during boot time

From: @xujing99 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
This commit is contained in:
openeuler-ci-bot 2023-12-21 09:12:19 +00:00 committed by Gitee
commit 1537c5cd89
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From c1a2ada89708d6aeeada496712cb24a4a58e75cc Mon Sep 17 00:00:00 2001
From: janana <40876700+jiayi0118@users.noreply.github.com>
Date: Wed, 29 Nov 2023 11:36:52 +0800
Subject: [PATCH] rules: go to the end of rules indeed when dm is suspended
The previous patch 466266c does not make sense indeed, that is to say, if the SYSTEMD_READY is not recorded in the database, the GOTO="systemd_end" will not be applied.
The IMPORT{db} is actually a matching token, it returns false when there is no SYSTEMD_READY recorded in the database.
The previous patch 466266c tended to inherit the state of SYSTEMD_READY from the database and skip to the end of current rule file. But when the database does not contain SYSTEMD_READY, e.g., the dm-* is not set db_persistent during initrd and the database will be cleared after switching root, the following rules will still be applied not as expected.
---
rules.d/99-systemd.rules.in | 4 +++-
test/fuzz/fuzz-udev-rules/99-systemd.rules | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/rules.d/99-systemd.rules.in b/rules.d/99-systemd.rules.in
index 9bf02a705f..455a2368eb 100644
--- a/rules.d/99-systemd.rules.in
+++ b/rules.d/99-systemd.rules.in
@@ -19,7 +19,9 @@ SUBSYSTEM=="ubi", TAG+="systemd"
SUBSYSTEM=="block", TAG+="systemd"
# We can't make any conclusions about suspended DM devices so let's just import previous SYSTEMD_READY state and skip other rules
-SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", IMPORT{db}="SYSTEMD_READY", GOTO="systemd_end"
+SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", IMPORT{db}="SYSTEMD_READY"
+SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", GOTO="systemd_end"
+
SUBSYSTEM=="block", ACTION=="add", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
# Ignore encrypted devices with no identified superblock on it, since
diff --git a/test/fuzz/fuzz-udev-rules/99-systemd.rules b/test/fuzz/fuzz-udev-rules/99-systemd.rules
index 278383b02c..5f29d709ae 100644
--- a/test/fuzz/fuzz-udev-rules/99-systemd.rules
+++ b/test/fuzz/fuzz-udev-rules/99-systemd.rules
@@ -17,7 +17,9 @@ SUBSYSTEM=="ubi", TAG+="systemd"
SUBSYSTEM=="block", TAG+="systemd"
# We can't make any conclusions about suspended DM devices so let's just import previous SYSTEMD_READY state and skip other rules
-SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", IMPORT{db}="SYSTEMD_READY", GOTO="systemd_end"
+SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", IMPORT{db}="SYSTEMD_READY"
+SUBSYSTEM=="block", ENV{DM_SUSPENDED}=="1", GOTO="systemd_end"
+
SUBSYSTEM=="block", ACTION=="add", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
# Ignore encrypted devices with no identified superblock on it, since
--
2.33.0

View File

@ -25,7 +25,7 @@
Name: systemd
Url: https://www.freedesktop.org/wiki/Software/systemd
Version: 253
Release: 8
Release: 9
License: MIT and LGPLv2+ and GPLv2+
Summary: System and Service Manager
@ -69,6 +69,7 @@ Patch6015: backport-udev-builtin-net_id-fix-potential-buffer-overflow.patch
Patch6016: backport-hostname-Make-sure-we-pass-error-to-bus_verify_polki.patch
Patch6017: backport-Limit-rlim_max-in-rlimit_nofile_safe-to-nr_open.patch
Patch6018: backport-udev-raise-RLIMIT_NOFILE-as-high-as-we-can.patch
Patch6019: backport-rules-go-to-the-end-of-rules-indeed-when-dm-is-suspe.patch
Patch9008: update-rtc-with-system-clock-when-shutdown.patch
Patch9009: udev-add-actions-while-rename-netif-failed.patch
@ -1587,6 +1588,9 @@ fi
%{_libdir}/security/pam_systemd.so
%changelog
* Thu Dec 21 2023 xujing <xujing125@huawei.com> - 253-9
- backport: fix /boot unmounted issue when the device is suspended during boot time
* Mon Dec 18 2023 huyubiao <huyubiao@huawei.com> - 253-8
- backport: sync patches from systemd community
add backport-core-path-do-not-enqueue-new-job-in-.trigger_notify-.patch