提交 271df90e 编写于 作者: V Vitaly Wool 提交者: Linus Torvalds

z3fold: fix spinlock unlocking in page reclaim

Commmit 5a27aa82 ("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: 5a27aa82 ("z3fold: add kref refcounting")
Link: http://lkml.kernel.org/r/20170311222239.7b83d8e7ef1914e05497649f@gmail.comReported-by: NAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: NVitaly Wool <vitalywool@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 69eea5a4
...@@ -667,6 +667,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) ...@@ -667,6 +667,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
z3fold_page_unlock(zhdr); z3fold_page_unlock(zhdr);
spin_lock(&pool->lock); spin_lock(&pool->lock);
if (kref_put(&zhdr->refcount, release_z3fold_page)) { if (kref_put(&zhdr->refcount, release_z3fold_page)) {
spin_unlock(&pool->lock);
atomic64_dec(&pool->pages_nr); atomic64_dec(&pool->pages_nr);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册