pid1: add "soft-reboot" reboot method

This adds a new mechanism for rebooting, a form of "userspace reboot"
hereby dubbed "soft-reboot". It will stop all services as in a usual
shutdown, possibly transition into a new root fs and then issue a fresh
initial transaction. The kernel is not replaced.

File descriptors can be passed over, thus opening the door for leaving
certain resources around between such reboots.

Usecase: this is an extremely quick way to reset userspace fully when
updating image based systems, without going through a full
hardware/firmware/boot loader/kernel/initrd cycle. It minimizes "grayout time"
for OS updates. (In particular when combined with kernel live patching)
This commit is contained in:
Lennart Poettering
2023-06-02 16:49:38 +02:00
parent 8f9a307fec
commit 13ffc60749
13 changed files with 161 additions and 26 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
#include <stdbool.h>
int switch_root(const char *new_root, const char *old_root_after, unsigned long mount_flags);
int switch_root(const char *new_root, const char *old_root_after, unsigned long mount_flags, bool destroy_old_root);