Re: [PATCH v5 5/6] nfsd: count NFSv4 callback operations per netns
From: Chuck Lever
Date: Thu Jun 18 2026 - 20:14:04 EST
On Thu, Jun 18, 2026, at 12:57 PM, Jeff Layton wrote:
> The NFS server tracks per-operation call counts for the forward channel
> (proc4ops) but keeps no statistics for the NFSv4 backchannel (callback)
> operations it sends to clients.
>
> Add a per-netns array of percpu counters for callback operations, indexed
> by RFC 8881 callback opcode (OP_CB_GETATTR..OP_CB_OFFLOAD), and bump the
> relevant counter in nfsd4_run_cb(), which is hit exactly once per callback
> that is actually queued.
>
> CB_GETATTR is sent when a GETATTR conflicts with an outstanding write
> delegation, which is roughly what the dedicated wdeleg_getattr counter
> tracked. The two are not identical: the old counter incremented on every
> such conflict, whereas the CB_GETATTR counter only counts callbacks that
> are actually queued, so concurrent conflicts that coalesce onto an
> already in-flight CB_GETATTR are now counted once rather than once per
> conflict. Report the procfs "wdeleg_getattr" line from the CB_GETATTR
> counter and drop the now-redundant NFSD_STATS_WDELEG_GETATTR counter, its
> helper, and its increment site.
>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> fs/nfsd/netns.h | 12 +++++++++++-
> fs/nfsd/nfs4callback.c | 7 ++++++-
> fs/nfsd/nfs4state.c | 2 --
> fs/nfsd/nfsctl.c | 14 ++++++++++++++
> fs/nfsd/stats.c | 2 +-
> fs/nfsd/stats.h | 5 +++--
> 6 files changed, 35 insertions(+), 7 deletions(-)
I agree with the Sashiko review that this patch introduces a UAF
possibility that needs to be addressed before the patch is applied.
--
Chuck Lever