Skip to content

Commit

Permalink
Revert "unit: add ordering dep relative to credentials dir"
Browse files Browse the repository at this point in the history
Causes a cycle at shutdown, undo the backport.

Jul 10 22:13:21 H systemd[1]: poweroff.target: Trying to enqueue job poweroff.target/start/replace-irreversibly
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found ordering cycle on run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found dependency on systemd-tmpfiles-setup-dev.service/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found dependency on local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Job run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount/stop deleted to break ordering cycle starting with local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found ordering cycle on systemd-tmpfiles-setup-dev.service/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on run-credentials-systemd\x2dsysusers.service.mount/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on systemd-sysusers.service/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Job systemd-tmpfiles-setup-dev.service/stop deleted to break ordering cycle starting with systemd-sysusers.service/stop

This reverts commit ad10ffe.
  • Loading branch information
bluca committed Jul 10, 2023
1 parent 7977cbd commit 4728105
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion src/core/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ static bool context_has_no_new_privileges(const ExecContext *c) {
context_has_syscall_logs(c);
}

bool exec_context_has_credentials(const ExecContext *context) {
static bool exec_context_has_credentials(const ExecContext *context) {

assert(context);

Expand Down
1 change: 0 additions & 1 deletion src/core/execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ const char* exec_context_fdname(const ExecContext *c, int fd_index);

bool exec_context_may_touch_console(const ExecContext *c);
bool exec_context_maintains_privileges(const ExecContext *c);
bool exec_context_has_credentials(const ExecContext *context);

int exec_context_get_effective_ioprio(const ExecContext *c);
bool exec_context_get_effective_mount_apivfs(const ExecContext *c);
Expand Down
20 changes: 0 additions & 20 deletions src/core/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1347,26 +1347,6 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
if (r < 0)
return r;

if (exec_context_has_credentials(c) && u->manager->prefix[EXEC_DIRECTORY_RUNTIME]) {
_cleanup_free_ char *p = NULL, *m = NULL;

/* Let's make sure the credentials directory of this service is unmounted *after* the service
* itself shuts down. This only matters if mount namespacing is not used for the service, and
* hence the credentials mount appears on the host. */

p = path_join(u->manager->prefix[EXEC_DIRECTORY_RUNTIME], "credentials", u->id);
if (!p)
return -ENOMEM;

r = unit_name_from_path(p, ".mount", &m);
if (r < 0)
return r;

r = unit_add_dependency_by_name(u, UNIT_AFTER, m, /* add_reference= */ true, UNIT_DEPENDENCY_FILE);
if (r < 0)
return r;
}

return 0;
}

Expand Down

0 comments on commit 4728105

Please sign in to comment.