]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: pblk: fix race condition on GC
authorHeiner Litz <hlitz@ucsc.edu>
Mon, 11 Feb 2019 12:25:09 +0000 (13:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2019 15:18:08 +0000 (08:18 -0700)
commitb3d35b78edcc85f7e3f33002b4dad82d7bd63b46
tree1bae68e44c9494ebe36106c7b8e8e0f65749222b
parent9581ac36ad4a3c8f3e99be84e4338081104d8a85
lightnvm: pblk: fix race condition on GC

This patch fixes a race condition where a write is mapped to the last
sectors of a line. The write is synced to the device but the L2P is not
updated yet. When the line is garbage collected before the L2P update
is performed, the sectors are ignored by the GC logic and the line is
freed before all sectors are moved. When the L2P is finally updated, it
contains a mapping to a freed line, subsequent reads of the
corresponding LBAs fail.

This patch introduces a per line counter specifying the number of
sectors that are synced to the device but have not been updated in the
L2P. Lines with a counter of greater than zero will not be selected
for GC.

Signed-off-by: Heiner Litz <hlitz@ucsc.edu>
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>
drivers/lightnvm/pblk-core.c
drivers/lightnvm/pblk-gc.c
drivers/lightnvm/pblk-map.c
drivers/lightnvm/pblk-rb.c
drivers/lightnvm/pblk-write.c
drivers/lightnvm/pblk.h