summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-10-15 16:29:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-10-15 16:29:08 +0000
commit3b7df0f5541178ecb3f438c5bccee271b2e5e526 (patch)
treeb1dcca8ff88e4e8bdb492a3a62b2561c5676f2cd /sys/scsi/sd.c
parent996e51bd2c7fdec931d33d64550dafe29480956f (diff)
In DVACT_SUSPEND, do a flush of the disk. We do this in DVACT_POWERDOWN
as well, but it might be wise to flush before a hibernate operation, in case hiberate looks at blocks which are in the buffer cache. ok krw
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 3b3aeeab7aa..275e17e93af 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.243 2012/10/08 21:47:51 deraadt Exp $ */
+/* $OpenBSD: sd.c,v 1.244 2012/10/15 16:29:07 deraadt Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -271,6 +271,12 @@ sdactivate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
+ /*
+ * We flush the cache, since we our next step before
+ * DVACT_POWERDOWN might be a hibernate operation.
+ */
+ if ((sc->flags & SDF_DIRTY) != 0)
+ sd_flush(sc, SCSI_AUTOCONF);
break;
case DVACT_POWERDOWN:
/*