summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2015-12-05 19:57:04 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2015-12-05 19:57:04 +0000
commitdfdd3e86762a9281a63b96b6c8185f02593c661f (patch)
treef48f730305bb0f796019533e99d5e63180649e6a
parentcaba86b9483ef1d167d209c878b2b9303204337d (diff)
vioblk: Don't send flush ops if flush feature not present
If we haven't negotiated the flush feature, don't send VIRTIO_BLK_T_FLUSH to the device. noticed by mlarkin@
-rw-r--r--sys/dev/pci/vioblk.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/vioblk.c b/sys/dev/pci/vioblk.c
index a35a07c1853..cda99ac3542 100644
--- a/sys/dev/pci/vioblk.c
+++ b/sys/dev/pci/vioblk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioblk.c,v 1.8 2015/12/05 19:55:33 sf Exp $ */
+/* $OpenBSD: vioblk.c,v 1.9 2015/12/05 19:57:03 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
@@ -339,6 +339,10 @@ vioblk_scsi_cmd(struct scsi_xfer *xs)
break;
case SYNCHRONIZE_CACHE:
+ if ((vsc->sc_features & VIRTIO_BLK_F_FLUSH) == 0) {
+ vioblk_scsi_done(xs, XS_NOERROR);
+ return;
+ }
operation = VIRTIO_BLK_T_FLUSH;
break;