aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2022-06-23 21:28:58 -0400
committerDavid Teigland <teigland@redhat.com>2022-08-01 09:31:46 -0500
commit958589892218e43ec83d5562438e0c1cc44a4716 (patch)
tree1f1e73b26254d944769759cad98ce9c349d1194f /fs/dlm
parent6b0afc0cc3e9a9a91f5a76d0965d449781441e18 (diff)
downloadlinux-958589892218e43ec83d5562438e0c1cc44a4716.tar.gz
fs: dlm: move kref_put assert for lkb structs
The unhold_lkb() function decrements the lock's kref, and asserts that the ref count was not the final one. Use the kref_put release function (which should not be called) to call the assert, rather than doing the assert based on the kref_put return value. Using kill_lkb() as the release function doesn't make sense if we only want to assert. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lock.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 739f09d0951c7..dac7eb75dba95 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1310,6 +1310,13 @@ static inline void hold_lkb(struct dlm_lkb *lkb)
kref_get(&lkb->lkb_ref);
}
+static void unhold_lkb_assert(struct kref *kref)
+{
+ struct dlm_lkb *lkb = container_of(kref, struct dlm_lkb, lkb_ref);
+
+ DLM_ASSERT(false, dlm_print_lkb(lkb););
+}
+
/* This is called when we need to remove a reference and are certain
it's not the last ref. e.g. del_lkb is always called between a
find_lkb/put_lkb and is always the inverse of a previous add_lkb.
@@ -1317,9 +1324,7 @@ static inline void hold_lkb(struct dlm_lkb *lkb)
static inline void unhold_lkb(struct dlm_lkb *lkb)
{
- int rv;
- rv = kref_put(&lkb->lkb_ref, kill_lkb);
- DLM_ASSERT(!rv, dlm_print_lkb(lkb););
+ kref_put(&lkb->lkb_ref, unhold_lkb_assert);
}
static void lkb_add_ordered(struct list_head *new, struct list_head *head,