aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Konopko <igor.j.konopko@intel.com>2018-06-01 10:41:09 -0400
committerJens Axboe <axboe@kernel.dk>2018-06-01 11:02:53 -0400
commitfbadca7396b97d95e2390c97506358f4f9dce7c7 (patch)
tree9e84e0b90a50b2e2e357c2fbf1fd6dfebc727b99
parentf142ac0b5d18547a9614a697f86820ee35fd7bf0 (diff)
lightnvm: fix partial read error path
When error occurs during bio_add_page on partial read path, pblk tries to free pages twice. Signed-off-by: Igor Konopko <igor.j.konopko@intel.com> Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/lightnvm/pblk-read.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 38f89a84ce5e..f770fd113ffe 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -256,7 +256,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,
256 new_bio = bio_alloc(GFP_KERNEL, nr_holes); 256 new_bio = bio_alloc(GFP_KERNEL, nr_holes);
257 257
258 if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes)) 258 if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
259 goto err; 259 goto err_add_pages;
260 260
261 if (nr_holes != new_bio->bi_vcnt) { 261 if (nr_holes != new_bio->bi_vcnt) {
262 pr_err("pblk: malformed bio\n"); 262 pr_err("pblk: malformed bio\n");
@@ -347,10 +347,10 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,
347 return NVM_IO_OK; 347 return NVM_IO_OK;
348 348
349err: 349err:
350 pr_err("pblk: failed to perform partial read\n");
351
352 /* Free allocated pages in new bio */ 350 /* Free allocated pages in new bio */
353 pblk_bio_free_pages(pblk, bio, 0, new_bio->bi_vcnt); 351 pblk_bio_free_pages(pblk, new_bio, 0, new_bio->bi_vcnt);
352err_add_pages:
353 pr_err("pblk: failed to perform partial read\n");
354 __pblk_end_io_read(pblk, rqd, false); 354 __pblk_end_io_read(pblk, rqd, false);
355 return NVM_IO_ERR; 355 return NVM_IO_ERR;
356} 356}