svn commit: r248596 - head/sys/geom
Konstantin Belousov
kib at FreeBSD.org
Thu Mar 21 22:36:44 UTC 2013
Author: kib
Date: Thu Mar 21 22:36:43 2013
New Revision: 248596
URL: http://svnweb.freebsd.org/changeset/base/248596
Log:
Correct the page count when excess length is trimmed from the bio.
Reported and tested by: Ivan Klymenko <fidaj at ukr.net
Modified:
head/sys/geom/geom_io.c
Modified: head/sys/geom/geom_io.c
==============================================================================
--- head/sys/geom/geom_io.c Thu Mar 21 22:24:54 2013 (r248595)
+++ head/sys/geom/geom_io.c Thu Mar 21 22:36:43 2013 (r248596)
@@ -718,8 +718,17 @@ g_io_schedule_down(struct thread *tp __u
*/
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,
More information about the svn-src-all
mailing list