summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarco <marco@openbsd.org>2009-06-02 21:23:11 +0000
committermarco <marco@openbsd.org>2009-06-02 21:23:11 +0000
commit9b7f09affb36b1abcdd9402bd56fffa8792a2dc9 (patch)
treeaccfe76e38a9a4084215a46910cf44689a0729c2
parentAdd some extra protection against non-monotonic timestamps. ok stevesk (diff)
downloadwireguard-openbsd-9b7f09affb36b1abcdd9402bd56fffa8792a2dc9.tar.xz
wireguard-openbsd-9b7f09affb36b1abcdd9402bd56fffa8792a2dc9.zip
Abuse bio layer a little less by marking fake buffers with B_PHYS.
From beck with lots of squealing and ear bleeds. Issue originally reported by todd. ok beck
-rw-r--r--sys/dev/softraid.c8
-rw-r--r--sys/dev/softraid_aoe.c6
-rw-r--r--sys/dev/softraid_crypto.c4
-rw-r--r--sys/dev/softraid_raid0.c4
-rw-r--r--sys/dev/softraid_raid1.c4
5 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index a6b8469893d..afb2c71a91f 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.139 2009/06/02 19:21:49 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.140 2009/06/02 21:23:11 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -281,7 +281,7 @@ sr_meta_probe(struct sr_discipline *sd, dev_t *dt, int no_chunk)
* XXX leaving dev open for now; move this to attach
* and figure out the open/close dance for unwind.
*/
- error = bdsw->d_open(dev, FREAD | FWRITE , S_IFBLK,
+ error = bdsw->d_open(dev, FREAD | FWRITE, S_IFBLK,
curproc);
if (error) {
DNPRINTF(SR_D_META,"%s: sr_meta_probe can't "
@@ -361,7 +361,7 @@ sr_meta_rw(struct sr_discipline *sd, dev_t dev, void *md, size_t sz,
}
bzero(&b, sizeof(b));
- b.b_flags = flags;
+ b.b_flags = flags | B_PHYS;
b.b_blkno = ofs;
b.b_bcount = sz;
b.b_bufsize = sz;
@@ -1908,7 +1908,7 @@ sr_ioctl_setstate(struct sr_softc *sc, struct bioc_setstate *bs)
rv = 0;
done:
if (open)
- (*bdsw->d_close)(dev, FREAD, S_IFCHR, curproc);
+ (*bdsw->d_close)(dev, FREAD | FWRITE, S_IFCHR, curproc);
return (rv);
}
diff --git a/sys/dev/softraid_aoe.c b/sys/dev/softraid_aoe.c
index 6601b68ab96..df21165120a 100644
--- a/sys/dev/softraid_aoe.c
+++ b/sys/dev/softraid_aoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_aoe.c,v 1.5 2009/05/11 14:06:21 jsing Exp $ */
+/* $OpenBSD: softraid_aoe.c,v 1.6 2009/06/02 21:23:11 marco Exp $ */
/*
* Copyright (c) 2008 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2008 Marco Peereboom <marco@openbsd.org>
@@ -738,7 +738,7 @@ resleep:
AOE_HDR2BLK(ap, blk);
memset(&buf, 0, sizeof buf);
buf.b_blkno = blk;
- buf.b_flags = B_WRITE;
+ buf.b_flags = B_WRITE | B_PHYS;
buf.b_bcount = len;
buf.b_bufsize = len;
buf.b_resid = len;
@@ -801,7 +801,7 @@ resleep:
AOE_HDR2BLK(ap, blk);
memset(&buf, 0, sizeof buf);
buf.b_blkno = blk;
- buf.b_flags = B_WRITE;
+ buf.b_flags = B_WRITE | B_PHYS;
buf.b_bcount = len;
buf.b_bufsize = len;
buf.b_resid = len;
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index ec1fef13ee2..1479ded33a3 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.34 2009/06/02 11:38:51 deraadt Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.35 2009/06/02 21:23:11 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -570,7 +570,7 @@ sr_crypto_rw2(struct sr_workunit *wu, struct cryptop *crp)
goto bad;
}
- ccb->ccb_buf.b_flags = B_CALL;
+ ccb->ccb_buf.b_flags = B_CALL | B_PHYS;
ccb->ccb_buf.b_iodone = sr_crypto_intr;
ccb->ccb_buf.b_blkno = blk;
ccb->ccb_buf.b_bcount = xs->datalen;
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c
index 8584ab74d57..f438c3cc96f 100644
--- a/sys/dev/softraid_raid0.c
+++ b/sys/dev/softraid_raid0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid0.c,v 1.14 2009/06/02 11:38:51 deraadt Exp $ */
+/* $OpenBSD: softraid_raid0.c,v 1.15 2009/06/02 21:23:11 marco Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
*
@@ -289,7 +289,7 @@ sr_raid0_rw(struct sr_workunit *wu)
strip_no, chunk, stripoffs, chunkoffs, physoffs, length,
leftover, data);
- ccb->ccb_buf.b_flags = B_CALL;
+ ccb->ccb_buf.b_flags = B_CALL | B_PHYS;
ccb->ccb_buf.b_iodone = sr_raid0_intr;
ccb->ccb_buf.b_blkno = physoffs >> DEV_BSHIFT;
ccb->ccb_buf.b_bcount = length;
diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c
index 719f18bed33..9a1195d07ef 100644
--- a/sys/dev/softraid_raid1.c
+++ b/sys/dev/softraid_raid1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid1.c,v 1.13 2009/06/02 16:32:23 marco Exp $ */
+/* $OpenBSD: softraid_raid1.c,v 1.14 2009/06/02 21:23:11 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -355,6 +355,7 @@ sr_raid1_rw(struct sr_workunit *wu)
ccb->ccb_buf.b_iodone = sr_raid1_intr;
}
+ ccb->ccb_buf.b_flags |= B_PHYS;
ccb->ccb_buf.b_blkno = blk;
ccb->ccb_buf.b_bcount = xs->datalen;
ccb->ccb_buf.b_bufsize = xs->datalen;
@@ -550,7 +551,6 @@ sr_raid1_intr(struct buf *bp)
if (wu->swu_flags & SR_WUF_REBUILD) {
if (wu->swu_xs->flags & SCSI_DATA_OUT) {
- //printf("waking up write\n");
wu->swu_flags |= SR_WUF_REBUILDIOCOMP;
wakeup(wu);
}