aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/md
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2001-11-05 18:48:54 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2001-11-05 18:48:54 +0000
commit7e76bb562eb8d0697a233e798405f37b4aeb0c6c (patch)
treede03e156782fad9ffef4684a7cf3f1908967e835 /sys/dev/md
parent93b2ae9fcf399d40b5b0fa3c4792cef61a616d16 (diff)
Notes
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 0a69769bdc7fe..bb4b7f0765e44 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -386,15 +386,18 @@ mdstart_vnode(struct md_s *sc)
auio.uio_rw = UIO_WRITE;
auio.uio_resid = bp->bio_bcount;
auio.uio_td = curthread;
- if (VOP_ISLOCKED(sc->vnode, NULL))
- vprint("unexpected md driver lock", sc->vnode);
+ /*
+ * When reading set IO_DIRECT to try to avoid double-caching
+ * the data. When writing IO_DIRECT is not optimal, but we
+ * must set IO_NOWDRAIN to avoid a wdrain deadlock.
+ */
if (bp->bio_cmd == BIO_READ) {
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
- error = VOP_READ(sc->vnode, &auio, 0, sc->cred);
+ error = VOP_READ(sc->vnode, &auio, IO_DIRECT, sc->cred);
} else {
(void) vn_start_write(sc->vnode, &mp, V_WAIT);
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
- error = VOP_WRITE(sc->vnode, &auio, 0, sc->cred);
+ error = VOP_WRITE(sc->vnode, &auio, IO_NOWDRAIN, sc->cred);
vn_finished_write(mp);
}
VOP_UNLOCK(sc->vnode, 0, curthread);