diff options
author | Wenwei Tao <ww.tao0320@gmail.com> | 2016-01-12 09:49:15 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-01-12 18:21:15 +0300 |
commit | 3cd485b1f8e25a6534eb4c542e7eba1b944fbaaf (patch) | |
tree | 57095214abdef867218f39434ed3ca72870d3263 /drivers/lightnvm/rrpc.c | |
parent | 168309855a7d1e16db751e9c647119fe2d2dc878 (diff) | |
download | linux-3cd485b1f8e25a6534eb4c542e7eba1b944fbaaf.tar.xz |
lightnvm: fix bio submission issue
Put bio when submission fails, since we get it
before submission. And return error when backend
device driver doesn't provide a submit_io method,
thus we can end IO properly.
Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm/rrpc.c')
-rw-r--r-- | drivers/lightnvm/rrpc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 134e4faba482..a1e7488c1f3e 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -650,11 +650,12 @@ static int rrpc_end_io(struct nvm_rq *rqd, int error) if (bio_data_dir(rqd->bio) == WRITE) rrpc_end_io_write(rrpc, rrqd, laddr, npages); + bio_put(rqd->bio); + if (rrqd->flags & NVM_IOTYPE_GC) return 0; rrpc_unlock_rq(rrpc, rqd); - bio_put(rqd->bio); if (npages > 1) nvm_dev_dma_free(rrpc->dev, rqd->ppa_list, rqd->dma_ppa_list); @@ -841,6 +842,7 @@ static int rrpc_submit_io(struct rrpc *rrpc, struct bio *bio, err = nvm_submit_io(rrpc->dev, rqd); if (err) { pr_err("rrpc: I/O submission failed: %d\n", err); + bio_put(bio); return NVM_IO_ERR; } |