Skip to content

Commit

Permalink
z3fold: fix spinlock unlocking in page reclaim
Browse files Browse the repository at this point in the history
Commmit 5a27aa8 ("z3fold: add kref refcounting") introduced a bug
in z3fold_reclaim_page() with function exit that may leave pool->lock
spinlock held.  Here comes the trivial fix.

Fixes: 5a27aa8 ("z3fold: add kref refcounting")
Link: http://lkml.kernel.org/r/20170311222239.7b83d8e7ef1914e05497649f@gmail.com
Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
vwool authored and torvalds committed Mar 16, 2017
1 parent 69eea5a commit 271df90
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/z3fold.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
z3fold_page_unlock(zhdr);
spin_lock(&pool->lock);
if (kref_put(&zhdr->refcount, release_z3fold_page)) {
spin_unlock(&pool->lock);
atomic64_dec(&pool->pages_nr);
return 0;
}
Expand Down

0 comments on commit 271df90

Please sign in to comment.