public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neilb@ownmail.net>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v7 2/2] NFSD: convert callback RPC program to per-net namespace
Date: Sat, 14 Mar 2026 19:01:58 -0400	[thread overview]
Message-ID: <48c2f680d4645070c2899e1fb83398ce405c8339.camel@kernel.org> (raw)
In-Reply-To: <e4a646d0-a916-419d-a78e-1a89977141a1@app.fastmail.com>

On Sat, 2026-03-14 at 11:47 -0400, Chuck Lever wrote:
> 
> On Sat, Mar 14, 2026, at 8:04 AM, Jeff Layton wrote:
> > On Fri, 2026-03-13 at 12:31 -0400, Chuck Lever wrote:
> > > From: Dai Ngo <dai.ngo@oracle.com>
> > > 
> > > The callback channel's rpc_program, rpc_version, rpc_stat,
> > > and per-procedure counts are declared as file-scope statics in
> > > nfs4callback.c, shared across all network namespaces.
> > > Forechannel RPC statistics are already maintained per-netns
> > > (via nfsd_svcstats in struct nfsd_net); the backchannel
> > > has no such separation. When backchannel statistics are
> > > eventually surfaced to userspace, the global counters would
> > > expose cross-namespace data.
> > > 
> > > Allocate per-netns copies of these structures through a new
> > > opaque struct nfsd_net_cb, managed by nfsd_net_cb_init()
> > > and nfsd_net_cb_shutdown(). The struct definition is private
> > > to nfs4callback.c; struct nfsd_net holds only a pointer.
> > > 
> > > Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> > > ---
> > >  fs/nfsd/netns.h        |   3 ++
> > >  fs/nfsd/nfs4callback.c | 111 ++++++++++++++++++++++++++++-------------
> > >  fs/nfsd/nfsctl.c       |   5 ++
> > >  fs/nfsd/state.h        |   9 ++++
> > >  4 files changed, 94 insertions(+), 34 deletions(-)
> > > 
> > > diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> > > index 6ad3fe5d7e12..27da1a3edacb 100644
> > > --- a/fs/nfsd/netns.h
> > > +++ b/fs/nfsd/netns.h
> > > @@ -25,6 +25,7 @@
> > >  #define SESSION_HASH_SIZE	512
> > >  
> > >  struct cld_net;
> > > +struct nfsd_net_cb;
> > >  struct nfsd4_client_tracking_ops;
> > >  
> > >  enum {
> > > @@ -228,6 +229,8 @@ struct nfsd_net {
> > >  	struct list_head	local_clients;
> > >  #endif
> > >  	siphash_key_t		*fh_key;
> > > +
> > > +	struct nfsd_net_cb	*nfsd_cb;
> > 
> > Given that there will only ever be one nfsd_cb per net, why not just
> > embed this struct inside the nfsd_net instead of doing a separate
> > allocation?
> 
> The reason I did this is because otherwise netns.h would need
> to have knowledge of the details of the NFSv4 callback program.
> Things like the NFSv4 callback program's RPC program number
> are implementation-defined...
> 
> I'm avoiding a weak layering violation by hiding those details
> behind a pointer.
> 

Meh. I'd probably have prioritized avoiding the extra allocation, but
that's a minor thing.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2026-03-14 23:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 16:31 [PATCH v7 0/2] NFSD: move accumulated callback ops to per-net namespace Chuck Lever
2026-03-13 16:31 ` [PATCH v7 1/2] NFSD: use per-operation statidx for callback procedures Chuck Lever
2026-03-14 11:55   ` Jeff Layton
2026-03-13 16:31 ` [PATCH v7 2/2] NFSD: convert callback RPC program to per-net namespace Chuck Lever
2026-03-14 12:04   ` Jeff Layton
2026-03-14 15:47     ` Chuck Lever
2026-03-14 23:01       ` Jeff Layton [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=48c2f680d4645070c2899e1fb83398ce405c8339.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cel@kernel.org \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@ownmail.net \
    --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