mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 10:13:34 +08:00
core: Imply DefaultDependencies=no for credential mounts
Currently, on soft-reboot, /run/credentials/@system is unmounted because it has DefaultDependencies=yes and as such will have Conflicts=umount.target and Before=umount.target. Let's make sure credential mounts survive soft-reboot by implying DefaultDependencies=no for credential mounts.
This commit is contained in:
parent
381c3b64d0
commit
3c0a1b1e70
@ -463,10 +463,7 @@ static int mount_add_default_ordering_dependencies(Mount *m, MountParameters *p,
|
||||
after = SPECIAL_LOCAL_FS_PRE_TARGET;
|
||||
before = SPECIAL_INITRD_USR_FS_TARGET;
|
||||
|
||||
} else if (mount_is_credentials(m))
|
||||
after = before = NULL;
|
||||
|
||||
else if (mount_is_network(p)) {
|
||||
} else if (mount_is_network(p)) {
|
||||
after = SPECIAL_REMOTE_FS_PRE_TARGET;
|
||||
before = SPECIAL_REMOTE_FS_TARGET;
|
||||
|
||||
@ -653,6 +650,9 @@ static int mount_add_extras(Mount *m) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (mount_is_credentials(m))
|
||||
u->default_dependencies = false;
|
||||
|
||||
r = unit_patch_contexts(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -10,6 +10,7 @@ TEST_SKIP_SHUTDOWN=yes
|
||||
IMAGE_NAME="softreboot"
|
||||
TEST_NO_NSPAWN=1
|
||||
TEST_INSTALL_VERITY_MINIMAL=1
|
||||
KERNEL_APPEND="${KERNEL_APPEND:-} systemd.set_credential=kernelcmdlinecred:uff"
|
||||
|
||||
# shellcheck source=test/test-functions
|
||||
. "$TEST_BASE_DIR/test-functions"
|
||||
|
@ -113,6 +113,9 @@ elif [ -f /run/testsuite82.touch ]; then
|
||||
cat /run/testsuite82.signal
|
||||
test "$(jq -r '.payload.data[1].type.data' </run/testsuite82.signal)" = "soft-reboot"
|
||||
|
||||
# Check that the system credentials survived the soft reboot.
|
||||
test "$(systemd-creds cat --system kernelcmdlinecred)" = "uff"
|
||||
|
||||
# Upload another entry
|
||||
T="/dev/shm/fdstore.$RANDOM"
|
||||
echo "miaumiau" >"$T"
|
||||
|
Loading…
Reference in New Issue
Block a user