Message ID | 20250325-nfs-net-nef-v1-1-0142cbd7e9ea@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | nfs: add a refcount tracker for struct net as held by the nfs_client | expand |
On Tue, 2025-03-25 at 07:44 -0400, Jeff Layton wrote: > Eric added refcount trackers to several long-held netns references in > the sunrpc layer in 2022. Add a tracker to the netns reference held by > the nfs_client as well. > > Cc: Eric Dumazet <edumazet@google.com> > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- > fs/nfs/client.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/nfs/client.c b/fs/nfs/client.c > index 3b0918ade53cd331d76baaa86fd2adec5d945b78..2ce58f2d6bf50924c38962ddedb7f0ca68752a8a 100644 > --- a/fs/nfs/client.c > +++ b/fs/nfs/client.c > @@ -180,7 +180,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) > clp->cl_proto = cl_init->proto; > clp->cl_nconnect = cl_init->nconnect; > clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect : 1; > - clp->cl_net = get_net(cl_init->net); > + clp->cl_net = get_net_track(cl_init->net, &clp->cl_ns_tracker, GFP_KERNEL); > > #if IS_ENABLED(CONFIG_NFS_LOCALIO) > seqlock_init(&clp->cl_boot_lock); > @@ -250,7 +250,7 @@ void nfs_free_client(struct nfs_client *clp) > if (!IS_ERR(clp->cl_rpcclient)) > rpc_shutdown_client(clp->cl_rpcclient); > > - put_net(clp->cl_net); > + put_net_track(clp->cl_net, &clp->cl_ns_track); > put_nfs_version(clp->cl_nfs_mod); > kfree(clp->cl_hostname); > kfree(clp->cl_acceptor); > > --- > base-commit: 38fec10eb60d687e30c8c6b5420d86e8149f7557 > change-id: 20250325-nfs-net-nef-fc2709b4efda > > Best regards, Please disregard this patch. This is an earlier version of the one I _actually_ tested. I'll send a v2 when I get back from LSF.
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 3b0918ade53cd331d76baaa86fd2adec5d945b78..2ce58f2d6bf50924c38962ddedb7f0ca68752a8a 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -180,7 +180,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) clp->cl_proto = cl_init->proto; clp->cl_nconnect = cl_init->nconnect; clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect : 1; - clp->cl_net = get_net(cl_init->net); + clp->cl_net = get_net_track(cl_init->net, &clp->cl_ns_tracker, GFP_KERNEL); #if IS_ENABLED(CONFIG_NFS_LOCALIO) seqlock_init(&clp->cl_boot_lock); @@ -250,7 +250,7 @@ void nfs_free_client(struct nfs_client *clp) if (!IS_ERR(clp->cl_rpcclient)) rpc_shutdown_client(clp->cl_rpcclient); - put_net(clp->cl_net); + put_net_track(clp->cl_net, &clp->cl_ns_track); put_nfs_version(clp->cl_nfs_mod); kfree(clp->cl_hostname); kfree(clp->cl_acceptor);
Eric added refcount trackers to several long-held netns references in the sunrpc layer in 2022. Add a tracker to the netns reference held by the nfs_client as well. Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> --- fs/nfs/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- base-commit: 38fec10eb60d687e30c8c6b5420d86e8149f7557 change-id: 20250325-nfs-net-nef-fc2709b4efda Best regards,