Compare commits

...

3 Commits

Author SHA1 Message Date
Luca Boccassi d200edb640
Merge db50a2b55c into 5b2926d941 2024-11-23 21:57:36 -08:00
Yu Watanabe 5b2926d941 curl-util: do not configure new io event source when the event loop is already dead
Similar to c5ecf09494, but for io event source.

Fixes #35322.
2024-11-23 22:49:57 +01:00
Luca Boccassi db50a2b55c man: beef up soft-reboot example unit
Note that journal sockets have to be mounted for softreboot surviving units,
as per thread on the ML, otherwise logging does not work afterwards:

https://lists.freedesktop.org/archives/systemd-devel/2024-June/050382.html

Remove the oneshot, as it didn't actually make sense for a sleep infinity.
And run in a separate image, to showcase that the unit should really be
disconnected from the rootfs.
2024-06-10 12:30:36 +01:00
2 changed files with 11 additions and 2 deletions

View File

@ -106,7 +106,10 @@
normal shutdown, reboot and maintenance mode. Finally, they have to be ordered after normal shutdown, reboot and maintenance mode. Finally, they have to be ordered after
<constant>basic.target</constant> to ensure correct ordering on boot. Note that in case any new or <constant>basic.target</constant> to ensure correct ordering on boot. Note that in case any new or
custom units are used to isolate to, or that implement an equivalent shutdown functionality, they will custom units are used to isolate to, or that implement an equivalent shutdown functionality, they will
also have to be configured manually for correct ordering and conflicting. For example:</para> also have to be configured manually for correct ordering and conflicting. In addition, to ensure the
service is disconnected from the rootfs resources (see next paragraph), it should run from a separate
image, but with the journal sockets mounted so that it is still allowed to log to the system journal.
For example:</para>
<programlisting>[Unit] <programlisting>[Unit]
Description=My Surviving Service Description=My Surviving Service
@ -118,7 +121,9 @@ Conflicts=reboot.target kexec.target poweroff.target halt.target rescue.target e
Before=shutdown.target rescue.target emergency.target Before=shutdown.target rescue.target emergency.target
[Service] [Service]
Type=oneshot RootImage=/var/lib/root.raw
TemporaryFileSystem=/run
BindReadOnlyPaths=/run/systemd/journal/socket /run/systemd/journal/stdout
ExecStart=sleep infinity</programlisting> ExecStart=sleep infinity</programlisting>
</listitem> </listitem>

View File

@ -75,6 +75,10 @@ static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, vo
return 0; return 0;
} }
/* Don't configure io event source anymore when the event loop is dead already. */
if (g->event && sd_event_get_state(g->event) == SD_EVENT_FINISHED)
return 0;
r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops); r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops);
if (r < 0) { if (r < 0) {
log_oom(); log_oom();