summaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2013-06-18 09:29:30 +0000
committerAlexander Motin <mav@FreeBSD.org>2013-06-18 09:29:30 +0000
commit9f9471e8b35430627ef9b3c1f4f7fbcf403d4a05 (patch)
treec60189b7431b2807f2840d4be1db7043301d8213 /sys/geom
parentcaa5855d32fb0fd7abb227cee5898dc515b46764 (diff)
downloadsrc-test2-9f9471e8b35430627ef9b3c1f4f7fbcf403d4a05.tar.gz
src-test2-9f9471e8b35430627ef9b3c1f4f7fbcf403d4a05.zip
Notes
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index f6111684bc2b..25a90de242da 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -718,8 +718,17 @@ g_io_schedule_down(struct thread *tp __unused)
*/
excess = bp->bio_offset + bp->bio_length;
if (excess > bp->bio_to->mediasize) {
+ KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 ||
+ round_page(bp->bio_ma_offset +
+ bp->bio_length) / PAGE_SIZE == bp->bio_ma_n,
+ ("excess bio %p too short", bp));
excess -= bp->bio_to->mediasize;
bp->bio_length -= excess;
+ if ((bp->bio_flags & BIO_UNMAPPED) != 0) {
+ bp->bio_ma_n = round_page(
+ bp->bio_ma_offset +
+ bp->bio_length) / PAGE_SIZE;
+ }
if (excess > 0)
CTR3(KTR_GEOM, "g_down truncated bio "
"%p provider %s by %d", bp,