Skip to content

RFC dlm: sand fix, rhashtable, timers and lookup hotpath speedup

Alexander Aring gfs2 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9dlm: increment ls_count on find_ls_to_scan()fs/dlm/lockspace.c+3 -00 replies
2/9dlm: change to non per bucket hashtable lockfs/dlm/debug_fs.c fs/dlm/dir.c fs/dlm/dlm_internal.h +4 more+60 -610 replies
3/9dlm: merge toss and keep hash into onefs/dlm/debug_fs.c fs/dlm/dir.c fs/dlm/dlm_internal.h +4 more+98 -760 replies
4/9dlm: fix avoid rsb hold during debugfs dumpfs/dlm/debug_fs.c fs/dlm/dlm_internal.h fs/dlm/lock.c +3 more+84 -2610 replies
5/9dlm: switch to use rhashtable for rsbsfs/dlm/config.c fs/dlm/config.h fs/dlm/dir.c +5 more+86 -1600 replies
6/9dlm: remove refcounting if rsb is on tossfs/dlm/lock.c fs/dlm/lock.h fs/dlm/recover.c+32 -320 replies
7/9dlm: drop scand kthread and use timersfs/dlm/dlm_internal.h fs/dlm/lock.c fs/dlm/lockspace.c +1 more+178 -2381 reply
8/9dlm: likely read lock path for rsb lookupfs/dlm/debug_fs.c fs/dlm/dir.c fs/dlm/dlm_internal.h +4 more+202 -841 reply
9/9dlm: convert lkbidr to rwlockfs/dlm/dlm_internal.h fs/dlm/lock.c fs/dlm/lockspace.c+11 -410 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC dlm/next 0/9] dlm: sand fix, rhashtable, timers and lookup hotpath speedup

Hi,

this is a RFC for an immense change in DLM rsb hashtable logic. It removes the double lookup functionality for rsb hashtables, convert to rhashtable instead of own bucket hlist hash implementation.

At first there is a fix for scand that I detected while I was implementing this patch series. It could be that remove messages are still send when the lockspace is releasing the resource that could occur into a use after free.

There is a conversion to use lists (keep/toss lists) instead of iterating over the hash bucket. As we do a transition to rhashtable, they don't like to being iterated regarding to their own bucket sizing implementation that is sitting in the rhashtable implementation. We just introduce the lists to do the iteration, as advantage we have a huge reduce of code in the debugfs dump functionality as we use the dump list helpers of debugfs. There is also a potential refcount bug when holding rsb references of rsbs in toss state as receive remove message requires no rsb references being hold. Another issue is also holding rsb in keep state as they are not going into toss state when they required to.

It is now forbidden to hold references of rsbs in toss state. The refcounter must be only functional in rsb keep state. That hopefully will show is more invalid usage of the rsb refcounter if the rsb is in toss state.

The scand was being fixed but now also it's removed. The scand process was holding the hashtable/hash bucket lock for a longer timer because it iterated over the whole hash. We use timers now to reduce the held time of the hashtable lock. We take here the advantage of the timers data structure that the rsb timer will delete the rsb itself from the hash. No lookup required as this is part of the timer subsystem.

As end we move very likely lookup hotpath to read lock mostly. This should for sure avoid contention in the most cases. Unlikely path need to still hold the write lock and do some extra relookup and check if the state of an rsb changed. However I think we hit over 90% the likely path that we only need to hold the read lock and avoid contention between processing DLM messages and the user triggers new DLM requests.

- Alex

Alexander Aring (9):
dlm: increment ls_count on find_ls_to_scan()
dlm: change to non per bucket hashtable lock
dlm: merge toss and keep hash into one
dlm: fix avoid rsb hold during debugfs dump
dlm: switch to use rhashtable for rsbs
dlm: remove refcounting if rsb is on toss
dlm: drop scand kthread and use timers
dlm: likely read lock path for rsb lookup
dlm: convert lkbidr to rwlock

 fs/dlm/config.c       |   8 +
 fs/dlm/config.h       |   2 +
 fs/dlm/debug_fs.c     | 212 ++----------
 fs/dlm/dir.c          |  14 +-
 fs/dlm/dlm_internal.h |  39 +--
 fs/dlm/lock.c         | 774 ++++++++++++++++++++++--------------------
 fs/dlm/lock.h         |   3 +-
 fs/dlm/lockspace.c    | 151 ++------
 fs/dlm/recover.c      |  38 ++-
 fs/dlm/recoverd.c     |  40 +--
 10 files changed, 541 insertions(+), 740 deletions(-)
Signature · 1 line
2.43.0