summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2024-08-02 13:26:44 -0400
committerDavid Teigland <teigland@redhat.com>2024-08-08 15:15:08 -0500
commit98ff7d95d91b56d8f2fdd0c4d0421f7fbb538cba (patch)
treeb426d96a5cf27e54f48ef2966c16db53ee421ccb
parent94e180d6255f5a765bb723e6e8b67f1438ce574b (diff)
downloadlinux-98ff7d95d91b56d8f2fdd0c4d0421f7fbb538cba.tar.gz
linux-98ff7d95d91b56d8f2fdd0c4d0421f7fbb538cba.tar.bz2
linux-98ff7d95d91b56d8f2fdd0c4d0421f7fbb538cba.zip
dlm: use RSB_HASHED to avoid lookup twice
Since commit 01fdeca1cc2d ("dlm: use rcu to avoid an extra rsb struct lookup") _dlm_master_lookup() is called under rcu lock that prevents that the rsb structure is being freed. There was a missing change to avoid an additional lookup and just check that the rsb is still part of the ls_rsbtbl structure. This patch is doing such check instead of lookup the rsb structure again. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--fs/dlm/lock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 30aec123a483..8bf3654f4827 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1308,11 +1308,11 @@ static int _dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *na
}
do_inactive:
- /* unlikely path - relookup under write */
+ /* unlikely path - check if still part of ls_rsbtbl */
write_lock_bh(&ls->ls_rsbtbl_lock);
- error = dlm_search_rsb_tree(&ls->ls_rsbtbl, name, len, &r);
- if (!error) {
+ /* see comment in find_rsb_dir */
+ if (rsb_flag(r, RSB_HASHED)) {
if (!rsb_flag(r, RSB_INACTIVE)) {
write_unlock_bh(&ls->ls_rsbtbl_lock);
/* something as changed, very unlikely but