public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: gfs2@lists.linux.dev, Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH 2/5] gfs2: Get rid of had_lock in gfs2_drevalidate
Date: Sat,  1 Nov 2025 08:09:16 +0000	[thread overview]
Message-ID: <20251101080919.1290117-3-agruenba@redhat.com> (raw)
In-Reply-To: <20251101080919.1290117-1-agruenba@redhat.com>

Get rid of variable had_lock in gfs2_drevalidate().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/dentry.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c
index fc2be386d3f0..ca470d4c4f9e 100644
--- a/fs/gfs2/dentry.c
+++ b/fs/gfs2/dentry.c
@@ -40,11 +40,11 @@ static int gfs2_drevalidate(struct inode *dir, const struct qstr *name,
 	struct gfs2_holder d_gh;
 	struct gfs2_inode *ip = NULL;
 	int error, valid;
-	int had_lock = 0;
 
 	if (flags & LOOKUP_RCU)
 		return -ECHILD;
 
+	gfs2_holder_mark_uninitialized(&d_gh);
 	inode = d_inode(dentry);
 
 	if (inode) {
@@ -53,8 +53,7 @@ static int gfs2_drevalidate(struct inode *dir, const struct qstr *name,
 		ip = GFS2_I(inode);
 	}
 
-	had_lock = (gfs2_glock_is_locked_by_me(dip->i_gl) != NULL);
-	if (!had_lock) {
+	if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) {
 		error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
 		if (error)
 			return 0;
@@ -62,9 +61,9 @@ static int gfs2_drevalidate(struct inode *dir, const struct qstr *name,
 
 	error = gfs2_dir_check(dir, name, ip);
 	valid = inode ? !error : (error == -ENOENT);
-
-	if (!had_lock)
+	if (gfs2_holder_initialized(&d_gh))
 		gfs2_glock_dq_uninit(&d_gh);
+
 	return valid;
 }
 
-- 
2.51.0


  parent reply	other threads:[~2025-11-01  8:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-01  8:09 [PATCH 0/5] gfs2 non-blocking lookup Andreas Gruenbacher
2025-11-01  8:09 ` [PATCH 1/5] gfs2: No d_revalidate op for "lock_nolock" mounts Andreas Gruenbacher
2025-11-01  8:09 ` Andreas Gruenbacher [this message]
2025-11-01  8:09 ` [PATCH 3/5] gfs2: Use unique tokens for gfs2_revalidate Andreas Gruenbacher
2025-11-01  8:09 ` [PATCH 4/5] gfs2: Enable non-blocking lookup in gfs2_permission Andreas Gruenbacher
2025-11-01  8:09 ` [PATCH 5/5] Revert "gfs2: Add GL_NOBLOCK flag" Andreas Gruenbacher
2025-11-17 12:16 ` [PATCH 0/5] gfs2 non-blocking lookup Andreas Gruenbacher

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=20251101080919.1290117-3-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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