Author: oshogbo
Date: Sun Sep 30 12:25:38 2018
New Revision: 339023
URL: https://svnweb.freebsd.org/changeset/base/339023

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

Modified:
  stable/11/sys/geom/eli/g_eli.c
  stable/11/sys/geom/eli/g_eli_privacy.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/eli/g_eli.c
==============================================================================
--- stable/11/sys/geom/eli/g_eli.c      Sun Sep 30 12:16:06 2018        
(r339022)
+++ stable/11/sys/geom/eli/g_eli.c      Sun Sep 30 12:25:38 2018        
(r339023)
@@ -252,7 +252,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);
@@ -297,7 +298,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: stable/11/sys/geom/eli/g_eli_privacy.c
==============================================================================
--- stable/11/sys/geom/eli/g_eli_privacy.c      Sun Sep 30 12:16:06 2018        
(r339022)
+++ stable/11/sys/geom/eli/g_eli_privacy.c      Sun Sep 30 12:25:38 2018        
(r339023)
@@ -87,7 +87,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?
         */
@@ -104,7 +105,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