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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to