Skip to content

Commit

Permalink
lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync
Browse files Browse the repository at this point in the history
rqd.error is masked by the return value of pblk_submit_io_sync.
The rqd structure is then passed on to the end_io function, which
assumes that any error should lead to a chunk being marked
offline/bad. Since the pblk_submit_io_sync can fail before the
command is issued to the device, the error value maybe not correspond
to a media failure, leading to chunks being immaturely retired.

Also, the pblk_blk_erase_sync function prints an error message in case
the erase fails. Since the caller prints an error message by itself,
remove the error message in this function.

Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Reviewed-by: Javier González <javier@cnexlabs.com>
Reviewed-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Matias Bjørling authored and Jens Axboe committed Oct 9, 2018
1 parent d7b6801 commit 4b5d56e
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions drivers/lightnvm/pblk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,30 +886,15 @@ static void pblk_setup_e_rq(struct pblk *pblk, struct nvm_rq *rqd,

static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa)
{
struct nvm_rq rqd;
int ret = 0;

memset(&rqd, 0, sizeof(struct nvm_rq));
struct nvm_rq rqd = {NULL};
int ret;

pblk_setup_e_rq(pblk, &rqd, ppa);

/* The write thread schedules erases so that it minimizes disturbances
* with writes. Thus, there is no need to take the LUN semaphore.
*/
ret = pblk_submit_io_sync(pblk, &rqd);
if (ret) {
struct nvm_tgt_dev *dev = pblk->dev;
struct nvm_geo *geo = &dev->geo;

pblk_err(pblk, "could not sync erase line:%d,blk:%d\n",
pblk_ppa_to_line(ppa),
pblk_ppa_to_pos(geo, ppa));

rqd.error = ret;
goto out;
}

out:
rqd.private = pblk;
__pblk_end_io_erase(pblk, &rqd);

Expand Down

0 comments on commit 4b5d56e

Please sign in to comment.