Skip to content

Commit 98ff7d9

Browse files
Alexander Aringteigland
authored andcommitted
dlm: use RSB_HASHED to avoid lookup twice
Since commit 01fdeca ("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 <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 94e180d commit 98ff7d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/dlm/lock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,11 +1308,11 @@ static int _dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *na
13081308
}
13091309

13101310
do_inactive:
1311-
/* unlikely path - relookup under write */
1311+
/* unlikely path - check if still part of ls_rsbtbl */
13121312
write_lock_bh(&ls->ls_rsbtbl_lock);
13131313

1314-
error = dlm_search_rsb_tree(&ls->ls_rsbtbl, name, len, &r);
1315-
if (!error) {
1314+
/* see comment in find_rsb_dir */
1315+
if (rsb_flag(r, RSB_HASHED)) {
13161316
if (!rsb_flag(r, RSB_INACTIVE)) {
13171317
write_unlock_bh(&ls->ls_rsbtbl_lock);
13181318
/* something as changed, very unlikely but

0 commit comments

Comments
 (0)