Skip to content

Commit

Permalink
socket: fix socket activation of stopped services with pinned FD store
Browse files Browse the repository at this point in the history
(cherry picked from commit 941a12dcba57f6673230a9c413738c51374d2998)
(cherry picked from commit 1a3d8368bcc8c123145955affd76a9c97f819ad5)
  • Loading branch information
msekletar authored and bluca committed Aug 16, 2024
1 parent 4fad420 commit 3888d11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ static int socket_start(Unit *u) {
/* If the service is already active we cannot start the
* socket */
if (!IN_SET(service->state,
SERVICE_DEAD, SERVICE_DEAD_BEFORE_AUTO_RESTART, SERVICE_FAILED, SERVICE_FAILED_BEFORE_AUTO_RESTART,
SERVICE_DEAD, SERVICE_DEAD_BEFORE_AUTO_RESTART, SERVICE_DEAD_RESOURCES_PINNED, SERVICE_FAILED, SERVICE_FAILED_BEFORE_AUTO_RESTART,
SERVICE_AUTO_RESTART, SERVICE_AUTO_RESTART_QUEUED))
return log_unit_error_errno(u, SYNTHETIC_ERRNO(EBUSY),
"Socket service %s already active, refusing.", UNIT(service)->id);
Expand Down Expand Up @@ -3381,7 +3381,7 @@ static void socket_trigger_notify(Unit *u, Unit *other) {
return;

if (IN_SET(SERVICE(other)->state,
SERVICE_DEAD, SERVICE_DEAD_BEFORE_AUTO_RESTART, SERVICE_FAILED, SERVICE_FAILED_BEFORE_AUTO_RESTART,
SERVICE_DEAD, SERVICE_DEAD_BEFORE_AUTO_RESTART, SERVICE_DEAD_RESOURCES_PINNED, SERVICE_FAILED, SERVICE_FAILED_BEFORE_AUTO_RESTART,
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL,
SERVICE_AUTO_RESTART, SERVICE_AUTO_RESTART_QUEUED))
socket_enter_listening(s);
Expand Down
10 changes: 10 additions & 0 deletions test/units/TEST-04-JOURNAL.stopped-socket-activation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail

systemctl stop systemd-journald.service
systemd-cat date

# shellcheck disable=SC2016
timeout 30 bash -xec 'until test "$(systemctl show -p SubState --value systemd-journald.service)" = "running"; do sleep 1; done'

0 comments on commit 3888d11

Please sign in to comment.