From: Dominik Maier <dmnk@google.com>
To: Chuck Lever <cel@kernel.org>, Jeff Layton <jlayton@kernel.org>
Cc: NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, dmnk+artist@google.com
Subject: [PATCH v2 1/2] nfsd: return GDD4_UNAVAIL when nfsd_file_acquire_dir() fails
Date: Tue, 24 Nov 2026 18:06:05 +0000 [thread overview]
Message-ID: <20261124180606.73719-2-dmnk@google.com> (raw)
In-Reply-To: <20261124180606.73719-1-dmnk@google.com>
The Linux NFS client requests a directory delegation by inserting
GET_DIR_DELEGATION between PUTFH and GETATTR in a single COMPOUND, and
_nfs4_proc_getattr() does not tolerate -EACCES. When
nfsd_file_acquire_dir() fails (for example for a non-owner doing stat()
on a mode 0711 directory without read permission), returning the error
aborts the COMPOUND before GETATTR and surfaces EACCES to stat().
Reply NFS4_OK with GDD4_UNAVAIL when nfsd_file_acquire_dir() fails,
matching the non-fatal nfsd_get_dir_deleg() path below so the delegation
is withheld while the trailing GETATTR still completes.
Fixes: 8b99f6a8c116 ("nfsd: wire up GET_DIR_DELEGATION handling")
Cc: stable@vger.kernel.org
Suggested-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Dominik Maier <dmnk@google.com>
---
Note: matching your snippet, this folds any nfsd_file_acquire_dir()
error into GDD4_UNAVAIL; let me know if you prefer narrowing it to
status == nfserr_acces so errors like NFS4ERR_NOTDIR or NFS4ERR_WRONGSEC
still surface directly.
fs/nfsd/nfs4proc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index b76320c265e1..dd17a6b47222 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -2873,8 +2873,10 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp,
__be32 status;
status = nfsd_file_acquire_dir(rqstp, &cstate->current_fh, &nf);
- if (status != nfs_ok)
- return status;
+ if (status != nfs_ok) {
+ gdd->gddrnf_status = GDD4_UNAVAIL;
+ return nfs_ok;
+ }
/*
* Offer no notifications to an order-aware client. RFC8881bis section
--
2.56.1.831.g720f3f5937-goog
next prev parent reply other threads:[~2026-11-24 18:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:06 [PATCH v2 0/2] nfsd: enforce search permission on directory delegations without breaking stat() Dominik Maier
2026-11-24 18:06 ` Dominik Maier [this message]
2026-11-24 19:45 ` [PATCH v2 1/2] nfsd: return GDD4_UNAVAIL when nfsd_file_acquire_dir() fails Chuck Lever
2026-11-24 20:02 ` Jeff Layton
2026-11-24 18:06 ` [PATCH v2 2/2] nfsd: require NFSD_MAY_EXEC when acquiring directory delegations Dominik Maier
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=20261124180606.73719-2-dmnk@google.com \
--to=dmnk@google.com \
--cc=Dai.Ngo@oracle.com \
--cc=cel@kernel.org \
--cc=dmnk+artist@google.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.