Author: oshogbo
Date: Sun Jul 15 18:03:19 2018
New Revision: 336310
URL: https://svnweb.freebsd.org/changeset/base/336310

Log:
  Let geli deal with lost devices without crashing.
  
  PR:           162036
  Submitted by: Fabian Keil <[email protected]>
  Obtained from:        ElectroBSD
  Discussed with: pjd@

Modified:
  head/sys/geom/eli/g_eli.c
  head/sys/geom/eli/g_eli_privacy.c

Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c   Sun Jul 15 18:02:50 2018        (r336309)
+++ head/sys/geom/eli/g_eli.c   Sun Jul 15 18:03:19 2018        (r336310)
@@ -254,7 +254,8 @@ g_eli_read_done(struct bio *bp)
                        pbp->bio_driver2 = NULL;
                }
                g_io_deliver(pbp, pbp->bio_error);
-               atomic_subtract_int(&sc->sc_inflight, 1);
+               if (sc != NULL)
+                       atomic_subtract_int(&sc->sc_inflight, 1);
                return;
        }
        mtx_lock(&sc->sc_queue_mtx);
@@ -299,7 +300,8 @@ g_eli_write_done(struct bio *bp)
         */
        sc = pbp->bio_to->geom->softc;
        g_io_deliver(pbp, pbp->bio_error);
-       atomic_subtract_int(&sc->sc_inflight, 1);
+       if (sc != NULL)
+               atomic_subtract_int(&sc->sc_inflight, 1);
 }
 
 /*

Modified: head/sys/geom/eli/g_eli_privacy.c
==============================================================================
--- head/sys/geom/eli/g_eli_privacy.c   Sun Jul 15 18:02:50 2018        
(r336309)
+++ head/sys/geom/eli/g_eli_privacy.c   Sun Jul 15 18:03:19 2018        
(r336310)
@@ -89,7 +89,8 @@ g_eli_crypto_read_done(struct cryptop *crp)
                        bp->bio_error = crp->crp_etype;
        }
        sc = bp->bio_to->geom->softc;
-       g_eli_key_drop(sc, crp->crp_desc->crd_key);
+       if (sc != NULL)
+               g_eli_key_drop(sc, crp->crp_desc->crd_key);
        /*
         * Do we have all sectors already?
         */
@@ -106,7 +107,8 @@ g_eli_crypto_read_done(struct cryptop *crp)
         * Read is finished, send it up.
         */
        g_io_deliver(bp, bp->bio_error);
-       atomic_subtract_int(&sc->sc_inflight, 1);
+       if (sc != NULL)
+               atomic_subtract_int(&sc->sc_inflight, 1);
        return (0);
 }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to