1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-03 05:18:09 +03:00
The systemd System and Service Manager
Go to file
Martin Wilck c072860593 99-systemd.rules: rework SYSTEMD_READY logic for device mapper
Device mapper devices are set up in multiple steps. The first step, which
generates the initial "add" event, only creates an empty container, which is
useless for higher layers. SYSTEMD_READY should be set to 0 on this event to
avoid premature device activation.

The event that matters is the "activation" event: the first "change" event on
which DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 is not set. When this event arrives,
the device is ready for being scanned by blkid and similar tools, and for being
activated by systemd.

Intermittent events with DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 should be ignored
as far as systemd or higher-level block layers are concerned. Previous device
properties and symlinks should be preserved: the device shouldn't be scanned or
activated, but shouldn't be deactivated, either.  In particular, SYSTEM_READY
shouldn't be set to 0 if it wasn't set before, because that might cause mounted
file systems to be unmounted. Such intermittent events may occur any time,
before or after the "activation" event.

DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 can have multiple reasons. One possible reason
is that the device is suspended. There are other reasons that depend on the
device-mapper subsystem (LVM, multipath, dm-crypt, etc.).

The current systemd rule set

1) sets SYSTEMD_READY=0 if DM_UDEV_DISABLE_OTHER_RULES_FLAG is set in "add"
events;
2) imports SYSTEMD_READY from the udev db if DM_SUSPENDED is set, and jumps to systemd_end;
3) sets SYSTEMD_READY=1, otherwise.

This logic has several flaws:

* 1) can cause file systems to be unmounted if an coldplug event arrives while
a file system is suspended. This rule shouldn't be applied for coldplug events
or in general, "synthetic" add events;
* 2) evaluates DM_SUSPENDED=1, which is a device-mapper internal property.
It's wrong to infer that a device is accessible if DM_SUSPENDED=0.
The jump to systemd_end may cause properties and/or symlinks to be lost;
* 3) is superfluous, because SYSTEMD_READY=1 is equivalent with SYSTEMD_READY
being unset, and can create the wrong impression that the device was explicitly
activated.

This patch fixes the logic as follows:

- apply 1) only if DM_NAME is empty, which is only the case for the first
"genuine add" event;
- change 2) to use DM_UDEV_DISABLE_OTHER_RULES_FLAG instead of DM_SUSPENDED,
and remove the GOTO directive;
- remove 3).

Fixes: b7cf1b6 ("udev: use SYSTEMD_READY to mask uninitialized DM devices")
Fixes: 35a6750 ("rules: set SYSTEMD_READY=0 on DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 only with ADD event (#2747)")

Signed-off-by: Martin Wilck <mwilck@suse.com>
2024-04-03 12:48:14 +01:00
.clusterfuzzlite ci: unpin CFLite 2022-04-26 09:13:57 +00:00
.github ci: fix commit SHA for stefanbuck/github-issue-parser 2024-04-02 17:19:16 +01:00
.semaphore semaphore: remove workaround for adduser 2024-03-11 11:15:12 +00:00
catalog catalog: update Polish translation 2024-03-12 11:37:17 +01:00
coccinelle cocci: merge mfree.cocci and mfree_return.cocci (#30838) 2024-01-09 12:24:37 +09:00
docs docs: notify example was moved to sd_notify manpage 2024-04-02 22:24:38 +01:00
factory man: don't suggest using pam_unix.so's use_authtok switch 2024-01-17 23:59:05 +00:00
hwdb.d hwdb: fix Asus T300FA rotation matrix (#31973) 2024-03-27 02:32:03 +09:00
LICENSES LICENSES/README.md: fix syntax 2023-07-08 22:33:53 +00:00
man Merge pull request #32030 from bluca/dlopen_document 2024-04-02 17:18:02 +01:00
mime creds-util: add a concept of "user-scoped" credentials 2024-01-30 17:07:47 +01:00
mkosi.conf.d Build distribution packages in mkosi 2024-03-07 10:47:19 +01:00
mkosi.images/system mkosi: Use '-' instead of '.' to separate upstream version and debian revision 2024-04-02 12:31:34 +02:00
modprobe.d modprobe: set 'ifb numifbs=0' to avoid autocreating ifb0 2024-01-12 23:24:54 +00:00
network network: fix 6rd tunnel link section name 2024-01-12 21:42:04 +00:00
pkg build(deps): bump pkg/debian from 44fe1d4 to e780b50 2024-04-02 11:37:01 +02:00
po po: Translated using Weblate (French) 2024-03-24 16:55:33 +01:00
presets preset: enable homed sidecar services 2024-02-08 22:44:00 +00:00
rules.d 99-systemd.rules: rework SYSTEMD_READY logic for device mapper 2024-04-03 12:48:14 +01:00
shell-completion Update _udevadm 2024-03-16 21:51:56 +09:00
src efivars: minor modernization for efi_set_variable 2024-04-03 10:03:53 +08:00
sysctl.d sysctl.d: Fix pid_max comment 2023-10-31 13:07:49 +01:00
sysusers.d Revert "sysusers.d: create the user for systemd-journal-upload.service" 2023-12-04 19:44:10 +01:00
test test: Always exit with 77 if we skip a test 2024-04-03 09:14:15 +09:00
tmpfiles.d networkctl: introduce "persistent-storage" command 2024-03-12 01:57:16 +09:00
tools git-contrib: use 'git shortlog' command 2024-04-03 10:07:54 +09:00
units units: remove implicit RequiresMountsFor= 2024-04-01 19:44:51 +08:00
xorg xorg/50-systemd-user: add a full license header 2021-10-01 14:45:00 +02:00
.clang-format Improve the formatting by adding AlignArrayOfStructures and setting it to Right(right justify) 2024-03-06 15:24:23 +01:00
.ctags editors: Prevent ctags from following symlinks 2019-02-15 11:01:20 -08:00
.dir-locals.el scripts: use 4 space indentation 2019-04-12 08:30:31 +02:00
.editorconfig editorconfig: add NEWS whitespace configuration 2023-10-26 22:41:03 +01:00
.gitattributes Mark all base64 files as generated 2023-08-16 12:49:45 +02:00
.gitignore Update to mkosi v19 2023-11-28 19:54:58 +01:00
.gitmodules Use .git suffix for all submodule urls 2024-03-25 13:27:12 +00:00
.mailmap mailmap: "reduce contributor count by 13" 2023-08-16 12:49:42 +02:00
.packit.yml Revert "packit: temporarily build systemd without BPF stuff" 2024-02-11 16:45:03 +01:00
.pylintrc Add .pylintrc to globally suppress warnings we don't really care about 2023-08-10 18:13:29 +02:00
.vimrc vimrc: explicitly set shiftwidth for the C file type 2023-09-18 13:11:45 +02:00
.ycm_extra_conf.py ycm: add doc string for all the functions in configuration file 2017-11-29 13:21:49 -07:00
LICENSE.GPL2 relicense to LGPLv2.1 (with exceptions) 2012-04-12 00:24:39 +02:00
LICENSE.LGPL2.1 licence: remove references to old FSF address 2012-12-17 11:41:31 +01:00
meson_options.txt fix the value of default shells to use /bin and not /usr/bin 2024-02-29 21:51:03 +01:00
meson.build Merge pull request #31552 from AdrianVovk/homed-update-policy-v2-split 2024-03-24 10:11:09 +00:00
meson.version meson: Start adding devel and rc suffixes to the project version 2024-02-14 15:36:34 +01:00
mkosi.conf mkosi: Switch to linux-virtual on Ubuntu 2024-03-29 15:58:13 +01:00
NEWS Rename uid0 to run0 2024-03-19 16:37:22 +01:00
README README: mention fq_codel 2024-02-22 19:14:31 +00:00
README.md Revert "docs: use collections to structure the data" 2024-02-23 09:48:47 +01:00
TODO TODO: drop line about bzip2/gzip 2024-04-02 22:22:29 +01:00

Systemd

System and Service Manager

Semaphore CI 2.0 Build Status
Coverity Scan Status
OSS-Fuzz Status
CIFuzz
CII Best Practices
CentOS CI - CentOS 9
CentOS CI - Arch
CentOS CI - Arch (sanitizers)
Fossies codespell report
Weblate
Coverage Status
Packaging status
OpenSSF Scorecard

Details

Most documentation is available on systemd's web site.

Assorted, older, general information about systemd can be found in the systemd Wiki.

Information about build requirements is provided in the README file.

Consult our NEWS file for information about what's new in the most recent systemd versions.

Please see the Code Map for information about this repository's layout and content.

Please see the Hacking guide for information on how to hack on systemd and test your modifications.

Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.

When preparing patches for systemd, please follow our Coding Style Guidelines.

If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel

Stable branches with backported patches are available in the stable repo.