From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, aahringo@redhat.com
Subject: [PATCHv2 v6.11-rc1 07/10] dlm: use RSB_HASHED to avoid lookup twice
Date: Fri, 2 Aug 2024 13:26:44 -0400 [thread overview]
Message-ID: <20240802172647.582745-7-aahringo@redhat.com> (raw)
In-Reply-To: <20240802172647.582745-1-aahringo@redhat.com>
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>
---
fs/dlm/lock.c | 6 +++---
1 file 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
--
2.43.0
next prev parent reply other threads:[~2024-08-02 17:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 17:26 [PATCHv2 v6.11-rc1 01/10] dlm: cleanup memory allocation helpers Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 02/10] dlm: remove unnecessary refcounts Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 03/10] dlm: never return invalid nodeid by dlm_our_nodeid() Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 04/10] dlm: warn about invalid nodeid comparsions Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 05/10] dlm: drop kobject release callback handling Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 06/10] dlm: async freeing of lockspace resources Alexander Aring
2024-08-02 17:26 ` Alexander Aring [this message]
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 08/10] dlm: move dlm_search_rsb_tree() out of lock Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 09/10] dlm: move lkb xarray lookup " Alexander Aring
2024-08-02 17:26 ` [PATCHv2 v6.11-rc1 10/10] dlm: do synchronized socket connect call Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240802172647.582745-7-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox