Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 08:39:56 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206650 - head/sys/geom
Message-ID:  <201004150839.o3F8duH0044969@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Apr 15 08:39:56 2010
New Revision: 206650
URL: http://svn.freebsd.org/changeset/base/206650

Log:
  g_io_check: respond to zero pp->mediasize with ENXIO
  
  Previsouly this condition was reported with EIO by bio_offset > mediasize
  check.
  Perhaps that check should be extended to bio_offset+bio_length > mediasize.
  
  MFC after:	1 week

Modified:
  head/sys/geom/geom_io.c

Modified: head/sys/geom/geom_io.c
==============================================================================
--- head/sys/geom/geom_io.c	Thu Apr 15 08:32:50 2010	(r206649)
+++ head/sys/geom/geom_io.c	Thu Apr 15 08:39:56 2010	(r206650)
@@ -309,8 +309,8 @@ g_io_check(struct bio *bp)
 	case BIO_READ:
 	case BIO_WRITE:
 	case BIO_DELETE:
-		/* Zero sectorsize is a probably lack of media */
-		if (pp->sectorsize == 0)
+		/* Zero sectorsize or mediasize is probably a lack of media. */
+		if (pp->sectorsize == 0 || pp->mediasize == 0)
 			return (ENXIO);
 		/* Reject I/O not on sector boundary */
 		if (bp->bio_offset % pp->sectorsize)



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