Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lightnvm: pblk: add initialization check

Add a sanity check to the pblk initialization sequence in order to
ensure that enough LUNs have been allocated to store the line metadata.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Javier González and committed by
Jens Axboe
b5e063a2 ee8d5c1a

+6
+6
drivers/lightnvm/pblk-init.c
··· 716 716 lm->emeta_bb = geo->nr_luns - i; 717 717 lm->min_blk_line = 1 + DIV_ROUND_UP(lm->smeta_sec + lm->emeta_sec[0], 718 718 geo->sec_per_blk); 719 + if (lm->min_blk_line > lm->blk_per_line) { 720 + pr_err("pblk: config. not supported. Min. LUN in line:%d\n", 721 + lm->blk_per_line); 722 + ret = -EINVAL; 723 + goto fail; 724 + } 719 725 720 726 ret = pblk_lines_alloc_metadata(pblk); 721 727 if (ret)