mirror of
https://github.com/troglobit/finit.git
synced 2026-11-02 13:20:32 +00:00
Only unmount non-protected filesystems at shutdown
This patch adds support for a more fine grained approach to what filesystems are unmounted at shutdown/reboot. This so we later can add support for `mdadm --wait-clean --scan`, which relies on /proc, /sys, and /dev being there before we call reboot(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b1fb536468
commit
f4327910d9
3 files changed
+121
-6
No files matched your search
@@ -86,6 +86,9 @@ static uev_t sighup_watcher, sigint_watcher, sigpwr_watcher;
|
||||
static uev_t sigchld_watcher, sigsegv_watcher;
|
||||
static uev_t sigstop_watcher, sigtstp_watcher, sigcont_watcher;
|
||||
|
||||
void unmount_tmpfs(void);
|
||||
void unmount_regular(void);
|
||||
|
||||
|
||||
void do_shutdown(shutop_t op)
|
||||
{
|
||||
@@ -141,17 +144,19 @@ void do_shutdown(shutop_t op)
|
||||
}
|
||||
|
||||
/* Unmount any tmpfs before unmounting swap ... */
|
||||
run("/bin/umount -r -a");
|
||||
unmount_tmpfs();
|
||||
run("/sbin/swapoff -e -a");
|
||||
|
||||
/* Now, unmount everything else ... err, just force it. */
|
||||
run("/bin/umount -n -f -r -a");
|
||||
/* ... unmount remaining regular file systems. */
|
||||
unmount_regular();
|
||||
|
||||
/* We sit on / so we must remount it ro, try all the things! */
|
||||
run("/bin/mount -n -o remount,ro -t dummytype dummydev /");
|
||||
run("/bin/mount -n -o remount,ro dummydev /");
|
||||
run("/bin/mount -n -o remount,ro /");
|
||||
|
||||
/* XXX: Call mdadm to mark RAID array(s) as clean before halting. */
|
||||
|
||||
_d("%s.", op == SHUT_REBOOT ? "Rebooting" : "Halting");
|
||||
if (op == SHUT_REBOOT)
|
||||
reboot(RB_AUTOBOOT);
|
||||
|
||||
Reference in new issue
Block a user