Author: mav
Date: Thu May  8 12:04:40 2014
New Revision: 265668
URL: http://svnweb.freebsd.org/changeset/base/265668

Log:
  MFC r264313:
  Do not increment bio_data in case of BIO_DELETE.
  
  This fixes KASSERT() panic in g_io_request().

Modified:
  stable/10/sys/geom/stripe/g_stripe.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/stripe/g_stripe.c
==============================================================================
--- stable/10/sys/geom/stripe/g_stripe.c        Thu May  8 11:59:23 2014        
(r265667)
+++ stable/10/sys/geom/stripe/g_stripe.c        Thu May  8 12:04:40 2014        
(r265668)
@@ -472,9 +472,10 @@ g_stripe_start_economic(struct bio *bp, 
 
        /* offset -= offset % stripesize; */
        offset -= offset & (stripesize - 1);
-       addr += length;
+       if (bp->bio_cmd != BIO_DELETE)
+               addr += length;
        length = bp->bio_length - length;
-       for (no++; length > 0; no++, length -= stripesize, addr += stripesize) {
+       for (no++; length > 0; no++, length -= stripesize) {
                if (no > sc->sc_ndisks - 1) {
                        no = 0;
                        offset += stripesize;
@@ -506,6 +507,9 @@ g_stripe_start_economic(struct bio *bp, 
                        cbp->bio_data = addr;
 
                cbp->bio_caller2 = sc->sc_disks[no];
+
+               if (bp->bio_cmd != BIO_DELETE)
+                       addr += stripesize;
        }
        /*
         * Fire off all allocated requests!
@@ -632,10 +636,13 @@ g_stripe_start(struct bio *bp)
         *    a provider, so there is nothing to optmize.
         * and
         * 4. Request is not unmapped.
+        * and
+        * 5. It is not a BIO_DELETE.
         */
        if (g_stripe_fast && bp->bio_length <= MAXPHYS &&
            bp->bio_length >= stripesize * sc->sc_ndisks &&
-           (bp->bio_flags & BIO_UNMAPPED) == 0) {
+           (bp->bio_flags & BIO_UNMAPPED) == 0 &&
+           bp->bio_cmd != BIO_DELETE) {
                fast = 1;
        }
        error = 0;
_______________________________________________
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