Let geli deal with lost devices without crashing.

PR:		162036
Submitted by:	Fabian Keil <fk@fabiankeil.de>
Obtained from:	ElectroBSD
Discussed with: pjd@
This commit is contained in:
Mariusz Zaborski 2018-07-15 18:03:19 +00:00
parent 52a05efab9
commit 78f79a9a08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336310
2 changed files with 8 additions and 4 deletions

View File

@ -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);
}
/*

View File

@ -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);
}