linux-stable/fs/dlm
Alexander Aring da9242d3af 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-09 10:26:21 +02:00
..
Kconfig fs: dlm: make connection hash lockless 2020-08-27 15:59:09 -05:00
Makefile
ast.c fs: dlm: use list_empty() to check last iteration 2021-12-07 12:42:26 -06:00
ast.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
config.c fs: dlm: rename socket and app buffer defines 2021-06-02 11:53:04 -05:00
config.h fs: dlm: rename socket and app buffer defines 2021-06-02 11:53:04 -05:00
debug_fs.c fs: dlm: fix potential buffer overflow 2021-11-12 09:38:19 -06:00
dir.c fs: dlm: use dlm_recovery_stopped in condition 2021-11-02 14:39:20 -05:00
dir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
dlm_internal.h fs: dlm: use event based wait for pending remove 2021-12-07 12:42:26 -06:00
lock.c dlm: fix missing lkb refcount handling 2022-06-09 10:26:21 +02:00
lock.h fs: dlm: add lkb waiters debugfs functionality 2021-11-02 14:39:20 -05:00
lockspace.c driver core changes for 5.17-rc1 2022-01-12 11:11:34 -08:00
lockspace.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
lowcomms.c dlm: uninitialized variable on error in dlm_listen_for_all() 2022-06-09 10:26:21 +02:00
lowcomms.h fs: dlm: memory cache for lowcomms hotpath 2021-12-07 12:42:26 -06:00
lvb_table.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
main.c fs: dlm: initial support for tracepoints 2021-11-02 14:39:20 -05:00
member.c fs: dlm: use dlm_recovery_stopped in condition 2021-11-02 14:39:20 -05:00
member.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
memory.c fs: dlm: memory cache for lowcomms hotpath 2021-12-07 12:42:26 -06:00
memory.h fs: dlm: memory cache for lowcomms hotpath 2021-12-07 12:42:26 -06:00
midcomms.c fs: dlm: memory cache for midcomms hotpath 2021-12-07 12:42:26 -06:00
midcomms.h fs: dlm: memory cache for midcomms hotpath 2021-12-07 12:42:26 -06:00
netlink.c genetlink: move to smaller ops wherever possible 2020-10-02 19:11:11 -07:00
plock.c dlm: fix plock invalid read 2022-06-09 10:26:21 +02:00
rcom.c fs: dlm: use dlm_recovery_stopped instead of test_bit 2021-11-02 14:39:20 -05:00
rcom.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
recover.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
recover.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
recoverd.c fs: dlm: use dlm_recovery_stopped in condition 2021-11-02 14:39:20 -05:00
recoverd.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
requestqueue.c fs: dlm: ls_count busy wait to event based wait 2021-11-02 14:39:20 -05:00
requestqueue.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
user.c dlm: user: Replace zero-length array with flexible-array member 2020-05-12 14:06:15 -05:00
user.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
util.c fs: dlm: add union in dlm header for lockspace id 2021-05-25 09:22:20 -05:00
util.h fs: dlm: public header in out utility 2021-05-25 09:22:20 -05:00