summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-init.c
diff options
context:
space:
mode:
authorJavier González <javier@javigon.com>2018-06-01 15:04:15 +0200
committerJens Axboe <axboe@kernel.dk>2018-06-01 07:43:53 -0600
commit2deeefc02dfff6b554020eb62aecf98814641372 (patch)
treedfbad7a5382c329d42d6da0cb85aeac9534973d5 /drivers/lightnvm/pblk-init.c
parent84e92c131a0a2c7b28d1aa98c69350bc3577f34c (diff)
downloadlinux-2deeefc02dfff6b554020eb62aecf98814641372.tar.bz2
lightnvm: pblk: fail gracefully on line alloc. failure
In the event of a line failing to allocate, fail gracefully and stop the pipeline to avoid more write failing in the same place. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r--drivers/lightnvm/pblk-init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 9a984abd3dfe..44f9ec8d4c2a 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -1047,6 +1047,11 @@ static int pblk_lines_init(struct pblk *pblk)
nr_free_chks += pblk_setup_line_meta(pblk, line, chunk_meta, i);
}
+ if (!nr_free_chks) {
+ pr_err("pblk: too many bad blocks prevent for sane instance\n");
+ return -EINTR;
+ }
+
pblk_set_provision(pblk, nr_free_chks);
kfree(chunk_meta);