]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rules: go to the end of rules indeed when dm is suspended
authorjanana <40876700+jiayi0118@users.noreply.github.com>
Wed, 29 Nov 2023 03:36:52 +0000 (11:36 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 29 Nov 2023 08:57:55 +0000 (09:57 +0100)
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
test/fuzz/fuzz-udev-rules/systemd.rules

index 9bf02a705fe8800d9c7e3fb38b9475a81e2d77a6..455a2368eb7aff0f949422be69be8a234bf06b10 100644 (file)
@@ -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
index 278383b02cc0acfaf4cb66b5330d61a7c9944aa5..5f29d709ae5419d83f82bc1c79928a7d8ddea9cd 100644 (file)
@@ -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