diff options
author | Javier González <javier@javigon.com> | 2018-06-01 15:04:16 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-06-01 07:43:53 -0600 |
commit | 1d8b33e05cea69a1b0b7f2f2a7c102b6583a984f (patch) | |
tree | e591e7a0e7ace394454241a3e42675dc34dff0c7 /drivers/lightnvm/pblk-init.c | |
parent | 2deeefc02dfff6b554020eb62aecf98814641372 (diff) | |
download | lwn-1d8b33e05cea69a1b0b7f2f2a7c102b6583a984f.tar.gz lwn-1d8b33e05cea69a1b0b7f2f2a7c102b6583a984f.zip |
lightnvm: pblk: recheck for bad lines at runtime
Bad blocks can grow at runtime. Check that the number of valid blocks in
a line are within the sanity threshold before allocating the line for
new writes.
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.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 44f9ec8d4c2a..fe501e6d45fc 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -127,10 +127,8 @@ static int pblk_l2p_recover(struct pblk *pblk, bool factory_init) if (!line) { /* Configure next line for user data */ line = pblk_line_get_first_data(pblk); - if (!line) { - pr_err("pblk: line list corrupted\n"); + if (!line) return -EFAULT; - } } return 0; @@ -141,6 +139,7 @@ static int pblk_l2p_init(struct pblk *pblk, bool factory_init) sector_t i; struct ppa_addr ppa; size_t map_size; + int ret = 0; map_size = pblk_trans_map_size(pblk); pblk->trans_map = vmalloc(map_size); @@ -152,7 +151,11 @@ static int pblk_l2p_init(struct pblk *pblk, bool factory_init) for (i = 0; i < pblk->rl.nr_secs; i++) pblk_trans_map_set(pblk, i, ppa); - return pblk_l2p_recover(pblk, factory_init); + ret = pblk_l2p_recover(pblk, factory_init); + if (ret) + vfree(pblk->trans_map); + + return ret; } static void pblk_rwb_free(struct pblk *pblk) |