summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2003-06-15 18:13:17 +0000
committeryar <yar@FreeBSD.org>2003-06-15 18:13:17 +0000
commit180cfbc14f376c745830944bac62fa42f45d6eb3 (patch)
tree7a3bb2e81c8c54a3e1a9dab413afa53409bc222c /sys/isa
parent66f662a622976cb236f15dc6c2767c396daa7c1d (diff)
downloadFreeBSD-src-180cfbc14f376c745830944bac62fa42f45d6eb3.zip
FreeBSD-src-180cfbc14f376c745830944bac62fa42f45d6eb3.tar.gz
Always set bio_resid properly in fdstrategy(),
as should every block device strategy routine. There was at least one evil consequence of not doing so: Some errors returned by fdstrategy() could be lost (EAGAIN, in particular.) PR: kern/52338 (in the audit-trail) Discussed with: bde
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/fd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index b6ec2c3..2d835a0 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -1669,6 +1669,7 @@ fdstrategy(struct bio *bp)
panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)",
(u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev));
fdc = fd->fdc;
+ bp->bio_resid = bp->bio_bcount;
if (fd->type == FDT_NONE || fd->ft == 0) {
bp->bio_error = ENXIO;
bp->bio_flags |= BIO_ERROR;
@@ -1712,9 +1713,7 @@ fdstrategy(struct bio *bp)
nblocks = fd->ft->size;
if (blknum + bp->bio_bcount / fdblk > nblocks) {
if (blknum >= nblocks) {
- if (bp->bio_cmd == BIO_READ)
- bp->bio_resid = bp->bio_bcount;
- else {
+ if (bp->bio_cmd != BIO_READ) {
bp->bio_error = ENOSPC;
bp->bio_flags |= BIO_ERROR;
}
OpenPOWER on IntegriCloud