z3fold: stricter locking and more careful reclaim
authorVitaly Wool <vitaly.wool@konsulko.com>
Tue, 15 Dec 2020 03:12:33 +0000 (19:12 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:54:10 +0000 (11:54 +0100)
commit746d179b0e66b986dd7e186adf48b01a0d0283c0
tree53e8fd14d1cf2eb210912224233cf2e755d55430
parentb8b1d4e96a1074707cbaf1df59ae328e691b2bd5
z3fold: stricter locking and more careful reclaim

commit dcf5aedb24f899d537e21c18ea552c780598d352 upstream.

Use temporary slots in reclaim function to avoid possible race when
freeing those.

While at it, make sure we check CLAIMED flag under page lock in the
reclaim function to make sure we are not racing with z3fold_alloc().

Link: https://lkml.kernel.org/r/20201209145151.18994-4-vitaly.wool@konsulko.com
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: <stable@vger.kernel.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/z3fold.c