summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorIgor Konopko2019-05-04 20:37:54 +0200
committerJens Axboe2019-05-06 18:19:17 +0200
commitd38954ed1b76a2814057cd4af92c6966bceb3d3c (patch)
tree1d3ea312afe100f2feb4d3e91759a37bb335dfe7 /drivers/lightnvm
parentlightnvm: pblk: cleanly fail when there is not enough memory (diff)
downloadkernel-qcow2-linux-d38954ed1b76a2814057cd4af92c6966bceb3d3c.tar.gz
kernel-qcow2-linux-d38954ed1b76a2814057cd4af92c6966bceb3d3c.tar.xz
kernel-qcow2-linux-d38954ed1b76a2814057cd4af92c6966bceb3d3c.zip
lightnvm: pblk: set proper read status in bio
Currently in case of read errors, bi_status is not set properly which leads to returning inproper data to layers above. This patch fix that by setting proper status in case of read errors. Also remove unnecessary warn_once(), which does not make sense in that place, since user bio is not used for interation with drive and thus bi_status will not be set here. Signed-off-by: Igor Konopko <igor.j.konopko@intel.com> Reviewed-by: Javier González <javier@javigon.com> Reviewed-by: Hans Holmberg <hans.holmberg@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-read.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index b8eb6bdb983b..7b7a04a80d67 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -175,11 +175,10 @@ static void pblk_read_check_rand(struct pblk *pblk, struct nvm_rq *rqd,
WARN_ONCE(j != rqd->nr_ppas, "pblk: corrupted random request\n");
}
-static void pblk_end_user_read(struct bio *bio)
+static void pblk_end_user_read(struct bio *bio, int error)
{
-#ifdef CONFIG_NVM_PBLK_DEBUG
- WARN_ONCE(bio->bi_status, "pblk: corrupted read bio\n");
-#endif
+ if (error && error != NVM_RSP_WARN_HIGHECC)
+ bio_io_error(bio);
bio_endio(bio);
}
@@ -219,7 +218,7 @@ static void pblk_end_io_read(struct nvm_rq *rqd)
struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
struct bio *bio = (struct bio *)r_ctx->private;
- pblk_end_user_read(bio);
+ pblk_end_user_read(bio, rqd->error);
__pblk_end_io_read(pblk, rqd, true);
}
@@ -298,7 +297,7 @@ static void pblk_end_partial_read(struct nvm_rq *rqd)
rqd->bio = NULL;
rqd->nr_ppas = nr_secs;
- bio_endio(bio);
+ pblk_end_user_read(bio, rqd->error);
__pblk_end_io_read(pblk, rqd, false);
}