ZFS on 9.1 doesn't see errors on geli volumes...

Fabian Keil freebsd-listen at fabiankeil.de
Tue Feb 19 14:58:32 UTC 2013


"Steven Hartland" <smh at freebsd.org> wrote:

> From: "John-Mark Gurney" <jmg at funkthat.com>

> > so, we just end up overwriting the bio_completed error...
> >
> > pjd, should we just put the bio_completed = line under an else?
> >
> > something like:
> > if (pbp->bio_error != 0) {
> > G_ELI_LOGREQ(0, pbp, "Crypto WRITE request failed (error=%d).",
> >     pbp->bio_error);
> > pbp->bio_completed = 0;
> > } else
> > pbp->bio_completed = pbp->bio_length;
> >
> > /* Write is finished, send it up. */
> > g_io_deliver(pbp, pbp->bio_error);
> > sc = pbp->bio_to->geom->softc;
> > atomic_subtract_int(&sc->sc_inflight, 1);
> >
> > But doesn't explain why read's aren't being counted though...
> 
> Looks like the read case will loose the error if its not the last
> bio in sector group.
> 
> The attached should fix both cases.

Works for me on 10-CURRENT, thanks.

> A question for someone familiar with geom: why is bio_completed
> not set to bio_length in the read success case? Is this correct
> or is this another little bug?

No idea, but I reported "another little bug" a while ago:
http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/162036
and while testing how the patch affects it, I discovered
that the panic can be prevented with:

diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index 4e35297..24969b0 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -183,7 +183,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);

atomic_*_int(&sc->sc_inflight, 1) seems to be used without
checking that sc isn't NULL pretty much everywhere in g_eli.c,
though, and it's not clear to me when it's safe and when it isn't.

> On a related note, if anyone's got some pointers to docs about
> the internals of geom, I'd be interested :)

Every time I looked for internal geom documentation in the
past I came up empty.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130219/ea210161/attachment.sig>


More information about the freebsd-fs mailing list