mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Jeff Layton" <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] nfsd: recall deleg if a requested dir attr change can't be encoded
Date: Fri, 19 Jun 2026 21:06:06 -0400	[thread overview]
Message-ID: <a16c3b22-3b24-4aef-8ca9-d6eb43be72b2@app.fastmail.com> (raw)
In-Reply-To: <20260619-dir-deleg-fixes-v2-1-ad22fe2c7d7d@kernel.org>



On Fri, Jun 19, 2026, at 5:32 PM, Jeff Layton wrote:
> When the client requested NOTIFY4_CHANGE_DIR_ATTRS,
> nfsd4_cb_notify_prepare() tried to append the dir attribute change to
> the CB_NOTIFY, but silently dropped it if the attrmask space
> reservation failed or nfsd4_encode_dir_attr_change() failed to marshal
> the change into the buffer. It then returned true and transmitted a
> CB_NOTIFY lacking the requested notification, leaving the client's
> cached directory attributes stale with no indication.
>
> RFC 8881 s10.9.4 requires the server to recall the delegation when the
> directory changes in a way that is not covered by the notification.
> Treat a failure to encode the dir attribute change like the per-event
> encode failures already handled in the loop above: set error and fall
> through to out_recall.
>
> The granted notification mask and the requested dir attribute mask come
> from independent fields of the GET_DIR_DELEGATION request, so a client
> can be granted NOTIFY4_CHANGE_DIR_ATTRS while requesting no specific dir
> attributes. nfsd4_encode_dir_attr_change() now distinguishes a genuine
> encode failure (which forces the recall) from that benign case (which
> simply omits the event).
>
> While we're in there, also remove an unneeded check for
> NOTIFY4_CHANGE_DIR_ATTRS from nfsd4_encode_dir_attr_change().
>
> Fixes: 757a16cd93d5 ("nfsd: add support to CB_NOTIFY for dir attribute 
> changes")
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> This version should address Chuck's comments about the NULL pointer
> handling.
> ---
> Changes in v2:
> - Allow nfsd4_encode_dir_attr_change() to return ERR_PTR when there are 
> errors
> - Drop unneeded NOTIFY4_CHANGE_DIR_ATTRS check
> - Link to v1: 
> https://lore.kernel.org/r/20260617-dir-deleg-fixes-v1-0-32b85b366c29@kernel.org
> ---
>  fs/nfsd/nfs4state.c | 43 ++++++++++++++++++++++++++++---------------
>  fs/nfsd/nfs4xdr.c   | 30 +++++++++++++++++-------------
>  2 files changed, 45 insertions(+), 28 deletions(-)

Sashiko reports (and gpt-5.5 agrees):

Pre-existing issues:
- [High] Genuine encode failures and `vfs_getattr` failures are silently masked as 0-length attributes, causing the directory attribute change event to be erroneously omitted instead of triggering a delegation recall.

But this isn’t really a pre-existing issue. It pre-exists this fix, yes,
but it was introduced by “nfsd: add support to CB_NOTIFY for dir
attribute changes”. What that means is this patch is not yet a complete
fix.


-- 
Chuck Lever

      reply	other threads:[~2026-06-20  1:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 21:32 Jeff Layton
2026-06-20  1:06 ` Chuck Lever [this message]

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=a16c3b22-3b24-4aef-8ca9-d6eb43be72b2@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®