aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-init.c
diff options
context:
space:
mode:
authorJavier González <[email protected]>2018-06-01 13:04:15 +0000
committerJens Axboe <[email protected]>2018-06-01 13:43:53 +0000
commit2deeefc02dfff6b554020eb62aecf98814641372 (patch)
treedfbad7a5382c329d42d6da0cb85aeac9534973d5 /drivers/lightnvm/pblk-init.c
parentMerge branch 'nvme-4.18' of git://git.infradead.org/nvme into for-4.18/block (diff)
downloadkernel-2deeefc02dfff6b554020eb62aecf98814641372.tar.gz
kernel-2deeefc02dfff6b554020eb62aecf98814641372.zip
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 <[email protected]> Signed-off-by: Matias Bjørling <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
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);