sd-daemon: Set SO_LINGER on AF_VSOCK notify socket fds
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 25 Apr 2024 17:35:07 +0000 (19:35 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 25 Apr 2024 19:29:34 +0000 (21:29 +0200)
commit74e07b33b05f6a7a7124f6e3a27fcd228837264e
treef0e5fa8a5e7b744cf52d11e401e246d734830c19
parent24f2ff116766ad2b9613f69424ad56dda033cd93
sd-daemon: Set SO_LINGER on AF_VSOCK notify socket fds

We're still seeing problems in mkosi CI where we lose notify messages
sent over vsock from virtual machines because the virtual machine shuts
down before the socket buffers are flushed.

Let's try setting SO_LINGER on vsock sockets so that the kernel waits
until the buffers are flushed when we close the file descriptor.

To make sure it works, let's get rid of our previous workaround that
sends EXIT_STATUS earlier to reduce the chance of it not arriving.
This way, if it doesn't work, we'll notice it immediately due to CI
failures.
src/libsystemd/sd-daemon/sd-daemon.c
src/shutdown/shutdown.c