From: Jeff Layton <jlayton@kernel.org>
To: Dominik Maier <dmnk@google.com>, Chuck Lever <cel@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: Re: [PATCH v2 1/2] nfsd: return GDD4_UNAVAIL when nfsd_file_acquire_dir() fails
Date: Tue, 24 Nov 2026 15:02:31 -0500 [thread overview]
Message-ID: <72a6b37071266b50e2f99ef06c1f580f8bc47c61.camel@kernel.org> (raw)
In-Reply-To: <20261124180606.73719-2-dmnk@google.com>
On Tue, 2026-11-24 at 18:06 +0000, Dominik Maier wrote:
> 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
Nice catch!
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-11-24 20:02 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 ` [PATCH v2 1/2] nfsd: return GDD4_UNAVAIL when nfsd_file_acquire_dir() fails Dominik Maier
2026-11-24 19:45 ` Chuck Lever
2026-11-24 20:02 ` Jeff Layton [this message]
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=72a6b37071266b50e2f99ef06c1f580f8bc47c61.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=cel@kernel.org \
--cc=dmnk+artist@google.com \
--cc=dmnk@google.com \
--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.