sync: fork off sync() in a process instead of a thread
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Dec 2017 17:24:28 +0000 (18:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Dec 2017 10:48:21 +0000 (11:48 +0100)
commit41bd3379efc0e5b5621c329ff55b99b2825f06c0
treed323517539ec23bb6010f0533597c66a71b4c063
parent0e50bfaefde2a01792f4e4bcad7e0d822c74835b
sync: fork off sync() in a process instead of a thread

Let's fork off sync() ina process instead of a thread, as a safety
measure. This is beneficial to ensure that the original process can exit
without having to wait for the sync() to finish (note that the kernel
will delay process termination until all threads finished their
syscalls). In case of hanging NFS this increases the chance that PID 1
can safely transition to the "systemd-shutdown" process as the sync() is
initiated early on but definitely not waited for.
src/basic/async.c
src/core/job.c