From d44a7945b7a38d13b3c561bb5666c6c91e298524 Mon Sep 17 00:00:00 2001 From: smh Date: Mon, 23 Nov 2015 12:17:46 +0000 Subject: [PATCH] MFC r290406: Fix g_eli error loss conditions Sponsored by: Multiplay git-svn-id: svn://svn.freebsd.org/base/stable/10@291195 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/geom/eli/g_eli.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index 96156215e..9a3713a4f 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -201,7 +201,7 @@ g_eli_read_done(struct bio *bp) G_ELI_LOGREQ(2, bp, "Request done."); pbp = bp->bio_parent; - if (pbp->bio_error == 0) + if (pbp->bio_error == 0 && bp->bio_error != 0) pbp->bio_error = bp->bio_error; g_destroy_bio(bp); /* @@ -212,7 +212,8 @@ g_eli_read_done(struct bio *bp) return; sc = pbp->bio_to->geom->softc; if (pbp->bio_error != 0) { - G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); + G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, + pbp->bio_error); pbp->bio_completed = 0; if (pbp->bio_driver2 != NULL) { free(pbp->bio_driver2, M_ELI); @@ -241,10 +242,8 @@ g_eli_write_done(struct bio *bp) G_ELI_LOGREQ(2, bp, "Request done."); pbp = bp->bio_parent; - if (pbp->bio_error == 0) { - if (bp->bio_error != 0) - pbp->bio_error = bp->bio_error; - } + if (pbp->bio_error == 0 && bp->bio_error != 0) + pbp->bio_error = bp->bio_error; g_destroy_bio(bp); /* * Do we have all sectors already? @@ -255,14 +254,15 @@ g_eli_write_done(struct bio *bp) free(pbp->bio_driver2, M_ELI); pbp->bio_driver2 = NULL; if (pbp->bio_error != 0) { - G_ELI_LOGREQ(0, pbp, "Crypto WRITE request failed (error=%d).", + G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, pbp->bio_error); pbp->bio_completed = 0; - } + } else + pbp->bio_completed = pbp->bio_length; + /* * Write is finished, send it up. */ - pbp->bio_completed = pbp->bio_length; sc = pbp->bio_to->geom->softc; g_io_deliver(pbp, pbp->bio_error); atomic_subtract_int(&sc->sc_inflight, 1); -- 2.45.0