Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 May 2010 23:11:43 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208682 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201005312311.o4VNBhA7050768@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon May 31 23:11:43 2010
New Revision: 208682
URL: http://svn.freebsd.org/changeset/base/208682

Log:
  Fix panic when reading label from provider with non power of 2 sector size.
  
  Reported by:	James R. Van Artsdalen <james-freebsd-fs2@jrv.org>
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Mon May 31 22:29:48 2010	(r208681)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Mon May 31 23:11:43 2010	(r208682)
@@ -183,7 +183,7 @@ vdev_geom_io(struct g_consumer *cp, int 
 {
 	struct bio *bp;
 	u_char *p;
-	off_t off;
+	off_t off, maxio;
 	int error;
 
 	ASSERT((offset % cp->provider->sectorsize) == 0);
@@ -193,14 +193,15 @@ vdev_geom_io(struct g_consumer *cp, int 
 	off = offset;
 	offset += size;
 	p = data;
+	maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize);
 	error = 0;
 
-	for (; off < offset; off += MAXPHYS, p += MAXPHYS, size -= MAXPHYS) {
+	for (; off < offset; off += maxio, p += maxio, size -= maxio) {
 		bzero(bp, sizeof(*bp));
 		bp->bio_cmd = cmd;
 		bp->bio_done = NULL;
 		bp->bio_offset = off;
-		bp->bio_length = MIN(size, MAXPHYS);
+		bp->bio_length = MIN(size, maxio);
 		bp->bio_data = p;
 		g_io_request(bp, cp);
 		error = biowait(bp, "vdev_geom_io");



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