summaryrefslogtreecommitdiffstats
path: root/sys/geom/bde
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-29 19:37:36 +0000
committerphk <phk@FreeBSD.org>2003-04-29 19:37:36 +0000
commit46e72efe5930ad94cfd80e4d55642c74cfe52852 (patch)
treecfba1053b6849dd89e472dc3a23dd3d88e447577 /sys/geom/bde
parent2c42cd5d31a2d2309bc050800eca6e80c88668f2 (diff)
downloadFreeBSD-src-46e72efe5930ad94cfd80e4d55642c74cfe52852.zip
FreeBSD-src-46e72efe5930ad94cfd80e4d55642c74cfe52852.tar.gz
When a bio comes back from below with a zero error code, check that
it wrote the full length. The only case where this should be able to happen is if we try to read/write past the end and the request is truncated. We obviously should never try to do that, so this code should never activate.
Diffstat (limited to 'sys/geom/bde')
-rw-r--r--sys/geom/bde/g_bde_work.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/geom/bde/g_bde_work.c b/sys/geom/bde/g_bde_work.c
index c2fc237..e4ffb52 100644
--- a/sys/geom/bde/g_bde_work.c
+++ b/sys/geom/bde/g_bde_work.c
@@ -403,6 +403,8 @@ g_bde_write_done(struct bio *bp)
KASSERT(sc != NULL, ("NULL sc"));
KASSERT(sp->owner != NULL, ("NULL sp->owner"));
g_trace(G_T_TOPOLOGY, "g_bde_write_done(%p)", sp);
+ if (bp->bio_error == 0 && bp->bio_completed != sp->size)
+ bp->bio_error = EIO;
sp->error = bp->bio_error;
g_destroy_bio(bp);
wp = sp->owner;
@@ -479,6 +481,8 @@ g_bde_read_done(struct bio *bp)
g_trace(G_T_TOPOLOGY, "g_bde_read_done(%p)", sp);
sc = bp->bio_caller2;
mtx_lock(&sc->worklist_mutex);
+ if (bp->bio_error == 0 && bp->bio_completed != sp->siz)
+ bp->bio_error = EIO;
sp->error = bp->bio_error;
if (sp->error == 0)
sp->state = VALID;
OpenPOWER on IntegriCloud