diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2018-02-10 05:24:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2018-02-10 05:24:24 +0000 |
commit | 46a5fdccdbec824aec3e3e383277baed4c200dee (patch) | |
tree | d5edda8fa947c8eeb74eb1c49f6b40b68b93b101 /sys/dev/acpi | |
parent | d02979485b47a573dd086a214bbd30bce63e5708 (diff) |
Syncronize filesystems to disk when suspending. Each mountpoint's vnodes
are pushed to disk. Dangling vnodes (unlinked files still in use) and
vnodes undergoing change by long-running syscalls are identified -- and
such filesystems are marked dirty on-disk while we are suspended (in case
power is lost, a fsck will be required). Filesystems without dangling or
busy vnodes are marked clean, resulting in faster boots following
"battery died" circumstances.
Tested by numerous developers, thanks for the feedback.
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index ea23d66040a..4e5fc3f7aa8 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.338 2018/02/08 09:42:48 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.339 2018/02/10 05:24:23 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -30,6 +30,8 @@ #include <sys/sched.h> #include <sys/reboot.h> #include <sys/sysctl.h> +#include <sys/mount.h> +#include <sys/syscallargs.h> #ifdef HIBERNATE #include <sys/hibernate.h> @@ -2503,6 +2505,7 @@ acpi_sleep_state(struct acpi_softc *sc, int sleepmode) if (config_suspend_all(DVACT_QUIESCE)) goto fail_quiesce; + vfs_stall(curproc, 1); #if NSOFTRAID > 0 sr_quiesce(); #endif @@ -2590,6 +2593,7 @@ fail_suspend: acpi_resume_mp(); #endif + vfs_stall(curproc, 0); bufq_restart(); fail_quiesce: @@ -2612,6 +2616,8 @@ fail_alloc: rw_enter_write(&sc->sc_lck); #endif /* NWSDISPLAY > 0 */ + sys_sync(curproc, NULL, NULL); + /* Restore hw.setperf */ if (cpu_setperf != NULL) cpu_setperf(perflevel); |