Author: markj
Date: Wed Jul 20 00:52:11 2016
New Revision: 303057
URL: https://svnweb.freebsd.org/changeset/base/303057

Log:
  MFC r302091:
  Do not complete pending gmirror BIOs when tearing down the provider.

Modified:
  stable/10/sys/geom/mirror/g_mirror.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/10/sys/geom/mirror/g_mirror.c        Wed Jul 20 00:51:09 2016        
(r303056)
+++ stable/10/sys/geom/mirror/g_mirror.c        Wed Jul 20 00:52:11 2016        
(r303057)
@@ -2127,8 +2127,21 @@ g_mirror_destroy_provider(struct g_mirro
        g_topology_lock();
        g_error_provider(sc->sc_provider, ENXIO);
        mtx_lock(&sc->sc_queue_mtx);
-       while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL)
-               g_io_deliver(bp, ENXIO);
+       while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL) {
+               /*
+                * Abort any pending I/O that wasn't generated by us.
+                * Synchronization requests and requests destined for individual
+                * mirror components can be destroyed immediately.
+                */
+               if (bp->bio_to == sc->sc_provider &&
+                   bp->bio_from->geom != sc->sc_sync.ds_geom) {
+                       g_io_deliver(bp, ENXIO);
+               } else {
+                       if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0)
+                               free(bp->bio_data, M_MIRROR);
+                       g_destroy_bio(bp);
+               }
+       }
        mtx_unlock(&sc->sc_queue_mtx);
        G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name,
            sc->sc_provider->name);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to