svn commit: r208682 -
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon May 31 23:11:44 UTC 2010
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 at 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");
More information about the svn-src-all
mailing list