NVMe: fix retry/error logic in nvme_queue_rq()
authorJens Axboe <axboe@fb.com>
Thu, 11 Dec 2014 20:58:39 +0000 (13:58 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 11 Dec 2014 20:58:39 +0000 (13:58 -0700)
commitfe54303ee2be293c1c5c7a53a152453789cabc2f
tree359ec0be601521afe7cde6dcbd47e6a66e1364a2
parent285dffc9101244ac65c29672a1fb3fe614b52238
NVMe: fix retry/error logic in nvme_queue_rq()

The logic around retrying and erroring IO in nvme_queue_rq() is broken
in a few ways:

- If we fail allocating dma memory for a discard, we return retry. We
  have the 'iod' stored in ->special, but we free the 'iod'.

- For a normal request, if we fail dma mapping of setting up prps, we
  have the same iod situation. Additionally, we haven't set the callback
  for the request yet, so we also potentially leak IOMMU resources.

Get rid of the ->special 'iod' store. The retry is uncommon enough that
it's not worth optimizing for or holding on to resources to attempt to
speed it up. Additionally, it's usually best practice to free any
request related resources when doing retries.

Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nvme-core.c