mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
lightnvm: pblk: protect line bitmap while submitting meta io
It seems pblk_dealloc_page would race against pblk_alloc_pages for line bitmap for sector allocation.The chances are very low but might as well protect the bitmap properly. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Reviewed-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
32c662c58a
commit
e57903fd97
1 changed files with 2 additions and 0 deletions
|
@ -486,12 +486,14 @@ void pblk_dealloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs)
|
|||
u64 addr;
|
||||
int i;
|
||||
|
||||
spin_lock(&line->lock);
|
||||
addr = find_next_zero_bit(line->map_bitmap,
|
||||
pblk->lm.sec_per_line, line->cur_sec);
|
||||
line->cur_sec = addr - nr_secs;
|
||||
|
||||
for (i = 0; i < nr_secs; i++, line->cur_sec--)
|
||||
WARN_ON(!test_and_clear_bit(line->cur_sec, line->map_bitmap));
|
||||
spin_unlock(&line->lock);
|
||||
}
|
||||
|
||||
u64 __pblk_alloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs)
|
||||
|
|
Loading…
Reference in a new issue