diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-17 10:30:04 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-17 10:30:04 +0000 |
commit | 062c2a01d67ed7582febd4b39a40ff86bf2eb799 (patch) | |
tree | 784731bb95789b3fc15d5ae895e7924233bb18f6 /sys/dev/pv | |
parent | 58c939e2991b4610f5712a97ad9ee99af0aa1541 (diff) |
Grant table entries must be disassociated once CCB is complete
Attempting to unload the map before all chunks are done may lead
to unnecessary looping.
Diffstat (limited to 'sys/dev/pv')
-rw-r--r-- | sys/dev/pv/xbf.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/dev/pv/xbf.c b/sys/dev/pv/xbf.c index 375ceed2638..83033dc8e02 100644 --- a/sys/dev/pv/xbf.c +++ b/sys/dev/pv/xbf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbf.c,v 1.31 2017/06/07 15:49:21 mikeb Exp $ */ +/* $OpenBSD: xbf.c,v 1.32 2017/07/17 10:30:03 mikeb Exp $ */ /* * Copyright (c) 2016, 2017 Mike Belopuhov @@ -785,6 +785,16 @@ xbf_complete_cmd(struct xbf_softc *sc, struct xbf_ccb_queue *cq, int desc) mtx_leave(&sc->sc_ccb_sqlck); + DPRINTF("%s: completing desc %d(%llu) op %u with error %d\n", + sc->sc_dev.dv_xname, desc, xrd->xrd_rsp.rsp_id, + xrd->xrd_rsp.rsp_op, xrd->xrd_rsp.rsp_status); + + memset(xrd, 0, sizeof(*xrd)); + xrd->xrd_req.req_id = desc; + + if (ccb->ccb_seen != ccb->ccb_want) + return; + if (ccb->ccb_bbuf.dma_size > 0) map = ccb->ccb_bbuf.dma_map; else @@ -794,18 +804,9 @@ xbf_complete_cmd(struct xbf_softc *sc, struct xbf_ccb_queue *cq, int desc) BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_dmat, map); - DPRINTF("%s: completing desc %d(%llu) op %u with error %d\n", - sc->sc_dev.dv_xname, desc, xrd->xrd_rsp.rsp_id, - xrd->xrd_rsp.rsp_op, xrd->xrd_rsp.rsp_status); - - memset(xrd, 0, sizeof(*xrd)); - xrd->xrd_req.req_id = desc; - - if (ccb->ccb_seen == ccb->ccb_want) { - ccb->ccb_xfer->resid = 0; - ccb->ccb_xfer->error = error; - TAILQ_INSERT_TAIL(cq, ccb, ccb_link); - } + ccb->ccb_xfer->resid = 0; + ccb->ccb_xfer->error = error; + TAILQ_INSERT_TAIL(cq, ccb, ccb_link); } void |