lkml.org 
[lkml]   [2017]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/6] lightnvm: pblk: protect line bitmap while submitting meta io
Date
> On 21 Sep 2017, at 13.26, Rakesh Pandit <rakesh@tuxera.com> wrote:
>
> 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. It's not even in fast path.
>
> Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
> ---
> drivers/lightnvm/pblk-core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index a230125..b92eabc 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -502,12 +502,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_lock(&line->lock);

Changed this to spin_unlock() when picking it up.

Javier.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-10-04 13:25    [W:0.064 / U:1.340 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site