summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2005-12-29 20:00:53 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2005-12-29 20:00:53 +0000
commit4e974cec464a9e0f0b9ba94ee6924b436da434a3 (patch)
tree6925ba83830391b6eac4aa9a276feb94df1c04c5 /sys/miscfs
parente302a7e8e6ecd03be15572f849517fe6b38fa02c (diff)
Fix wrong optimization in spec_write() that goes: if we are about to do
a write that will globber the whole buffer, and it's not in cache, do not bother reading it in. That's wrong, since the user may be trying to write beyond the disk extent, in which case we definitely want to return an error, rather than returning saying the write was okay, and failing later on at an 'uncatched' biodone(). Okay tedu@.
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/specfs/spec_vnops.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index c17f2af5740..abd1dfa98c8 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.29 2005/05/24 04:45:13 pedro Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.30 2005/12/29 20:00:52 pedro Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -389,10 +389,7 @@ spec_write(v)
bn = (uio->uio_offset / ssize) &~ (bscale - 1);
on = uio->uio_offset % bsize;
n = min((unsigned)(bsize - on), uio->uio_resid);
- if (n == bsize)
- bp = getblk(vp, bn, bsize, 0, 0);
- else
- error = bread(vp, bn, bsize, NOCRED, &bp);
+ error = bread(vp, bn, bsize, NOCRED, &bp);
n = min(n, bsize - bp->b_resid);
if (error) {
brelse(bp);