summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-gc.c
diff options
context:
space:
mode:
authorIgor Konopko <igor.j.konopko@intel.com>2019-05-04 20:37:47 +0200
committerJens Axboe <axboe@kernel.dk>2019-05-06 18:19:16 +0200
commit8935ebfc5d462891e9dccec1f5cf438fb7bb96b4 (patch)
tree3e5934a73a51d264068fc8bda377651983a00d1c /drivers/lightnvm/pblk-gc.c
parentlightnvm: pblk: line reference fix in GC (diff)
downloadlinux-8935ebfc5d462891e9dccec1f5cf438fb7bb96b4.tar.xz
linux-8935ebfc5d462891e9dccec1f5cf438fb7bb96b4.zip
lightnvm: pblk: rollback on error during gc read
A line is left unsigned to the blocks lists in case pblk_gc_line returns an error. This moves the line back to be appropriate list, which can then be picked up by the garbage collector. Signed-off-by: Igor Konopko <igor.j.konopko@intel.com> Reviewed-by: Hans Holmberg <hans.holmberg@cnexlabs.com> Reviewed-by: Javier González <javier@javigon.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--drivers/lightnvm/pblk-gc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index 901e49951ab5..65692e6d76e6 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -358,8 +358,13 @@ static int pblk_gc_read(struct pblk *pblk)
pblk_gc_kick(pblk);
- if (pblk_gc_line(pblk, line))
+ if (pblk_gc_line(pblk, line)) {
pblk_err(pblk, "failed to GC line %d\n", line->id);
+ /* rollback */
+ spin_lock(&gc->r_lock);
+ list_add_tail(&line->list, &gc->r_list);
+ spin_unlock(&gc->r_lock);
+ }
return 0;
}