Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Mar 2013 22:36:44 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248596 - head/sys/geom
Message-ID:  <201303212236.r2LMaiQD055568@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303212236.r2LMaiQD055568>