From: Andreas Gruenbacher <agruenba@redhat.com>
To: gfs2@lists.linux.dev
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH 9/9] gfs2: Fix LOOKUP_RCU support in gfs2_drevalidate
Date: Fri, 19 Jan 2024 22:20:56 +0100 [thread overview]
Message-ID: <20240119212056.805617-10-agruenba@redhat.com> (raw)
In-Reply-To: <20240119212056.805617-1-agruenba@redhat.com>
Fix non-sleeping lookups in gfs2_drevalidate() by passing the FGP_NOWAIT
flag down to gfs2_dir_check(). This will cause gfs2_dir_check() to
return -EAGAIN when it would otherwise sleep.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/dentry.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c
index 99239d80982b..b14956cdab0e 100644
--- a/fs/gfs2/dentry.c
+++ b/fs/gfs2/dentry.c
@@ -74,12 +74,20 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags)
goto out;
}
- error = gfs2_dir_check(dinode, &dentry->d_name, ip, 0);
+ if (flags & LOOKUP_RCU) {
+ error = gfs2_dir_check(dinode, &dentry->d_name, ip, FGP_NOWAIT);
+ if (error == -EAGAIN) {
+ error = -ECHILD;
+ goto out;
+ }
+ } else {
+ error = gfs2_dir_check(dinode, &dentry->d_name, ip, 0);
+ }
error = inode ? !error : (error == -ENOENT);
+out:
if (gfs2_holder_initialized(&d_gh))
gfs2_glock_dq_uninit(&d_gh);
-out:
dput(parent);
return error;
}
--
2.43.0
next prev parent reply other threads:[~2024-01-19 21:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 21:20 [PATCH 0/9] gfs2: Bugs in "Use GL_NOBLOCK flag for non-blocking lookups" Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 1/9] gfs2: Fix gfs2_drevalidate NULL pointer dereference Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 2/9] gfs2: Pass FGP flags to gfs2_getbuf Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 3/9] gfs2: Split gfs2_meta_read_async off from gfs2_meta_read Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 4/9] gfs2: Add FGP_NOWAIT support to gfs2_meta_read_async Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 5/9] gfs2: Pass FGP flags to gfs2_meta_{,inode_}buffer Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 6/9] gfs2: Pass FGP flags to gfs2_dirent_search Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 7/9] gfs2: Pass FGP flags to gfs2_dir_check Andreas Gruenbacher
2024-01-19 21:20 ` [PATCH 8/9] gfs2: Minor gfs2_drevalidate cleanup Andreas Gruenbacher
2024-01-19 21:20 ` Andreas Gruenbacher [this message]
2024-01-20 1:36 ` [PATCH 0/9] gfs2: Bugs in "Use GL_NOBLOCK flag for non-blocking lookups" Al Viro
2024-01-20 1:38 ` Al Viro
2024-01-22 12:52 ` Andrew Price
2024-02-02 4:23 ` Al Viro
2024-02-02 4:34 ` Al Viro
2024-02-02 16:32 ` Andreas Gruenbacher
2024-02-02 4:59 ` Al Viro
2024-02-02 5:02 ` Al Viro
2024-02-02 17:09 ` 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=20240119212056.805617-10-agruenba@redhat.com \
--to=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--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