linux-stable/fs/dlm
Alexander Aring 827b6032ed dlm: fix missing lkb refcount handling
commit 1689c16913 upstream.

We always call hold_lkb(lkb) if we increment lkb->lkb_wait_count.
So, we always need to call unhold_lkb(lkb) if we decrement
lkb->lkb_wait_count. This patch will add missing unhold_lkb(lkb) if we
decrement lkb->lkb_wait_count. In case of setting lkb->lkb_wait_count to
zero we need to countdown until reaching zero and call unhold_lkb(lkb).
The waiters list unhold_lkb(lkb) can be removed because it's done for
the last lkb_wait_count decrement iteration as it's done in
_remove_from_waiters().

This issue was discovered by a dlm gfs2 test case which use excessively
dlm_unlock(LKF_CANCEL) feature. Probably the lkb->lkb_wait_count value
never reached above 1 if this feature isn't used and so it was not
discovered before.

The testcase ended in a rsb on the rsb keep data structure with a
refcount of 1 but no lkb was associated with it, which is itself
an invalid behaviour. A side effect of that was a condition in which
the dlm was sending remove messages in a looping behaviour. With this
patch that has not been reproduced.

Cc: stable@vger.kernel.org
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-14 16:53:53 +02:00
..
ast.c dlm: Don't swamp the CPU with callbacks queued during recovery 2019-02-12 19:45:57 +01:00
ast.h
config.c fs: dlm: fix memory leak when fenced 2021-07-20 16:17:33 +02:00
config.h
debug_fs.c fs: dlm: fix debugfs dump 2021-05-22 10:57:35 +02:00
dir.c
dir.h
dlm_internal.h dlm: remove BUG() before panic() 2020-06-25 15:41:52 +02:00
Kconfig
lock.c dlm: fix missing lkb refcount handling 2022-06-14 16:53:53 +02:00
lock.h
lockspace.c dlm: Fix kobject memleak 2020-08-21 09:48:13 +02:00
lockspace.h
lowcomms.c fs: dlm: cancel work sync othercon 2021-07-20 16:17:33 +02:00
lowcomms.h
lvb_table.h
main.c
Makefile
member.c dlm: fix possible call to kfree() for non-initialized pointer 2019-12-17 20:37:41 +01:00
member.h
memory.c dlm: NULL check before kmem_cache_destroy is not needed 2019-12-17 20:38:17 +01:00
memory.h
midcomms.c
midcomms.h
netlink.c
plock.c dlm: fix plock invalid read 2022-06-14 16:53:52 +02:00
rcom.c
rcom.h
recover.c
recover.h
recoverd.c
recoverd.h
requestqueue.c
requestqueue.h
user.c dlm: fix invalid cluster name warning 2019-12-17 20:38:33 +01:00
user.h
util.c
util.h