Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	 Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>,  Tom Talpey <tom@talpey.com>,
	"David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
	 Benjamin Coddington <bcodding@redhat.com>,
	linux-nfs@vger.kernel.org,  linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org,  Jeff Layton <jlayton@kernel.org>
Subject: [PATCH RFC 7/9] auth_gss: don't hold a net reference in gss_auth
Date: Mon, 17 Mar 2025 16:59:59 -0400	[thread overview]
Message-ID: <20250317-rpc-shutdown-v1-7-85ba8e20b75d@kernel.org> (raw)
In-Reply-To: <20250317-rpc-shutdown-v1-0-85ba8e20b75d@kernel.org>

It's not clear to me that these net references were ever needed. They
were added in commit e726340ac9cf ("RPCSEC_GSS: Further cleanups"), but
there no is explanation for taking it in the patch description and it's
not clear what race this prevents.

Now that the gssproxy client is shut down in pre_exit, there should be
no need to keep a reference here.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 net/sunrpc/auth_gss/auth_gss.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 78571776f446e2097bf25642c182d57546502803..9698914d7ed3e5674351f9cc4f43c08d7b746bc3 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -89,7 +89,6 @@ struct gss_auth {
 	enum rpc_gss_svc service;
 	struct rpc_clnt *client;
 	struct net	*net;
-	netns_tracker	ns_tracker;
 	/*
 	 * There are two upcall pipes; dentry[1], named "gssd", is used
 	 * for the new text-based upcall; dentry[0] is named after the
@@ -1045,12 +1044,11 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
 			goto err_free;
 	}
 	gss_auth->client = clnt;
-	gss_auth->net = get_net_track(rpc_net_ns(clnt), &gss_auth->ns_tracker,
-				      GFP_KERNEL);
+	gss_auth->net = rpc_net_ns(clnt);
 	err = -EINVAL;
 	gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
 	if (!gss_auth->mech)
-		goto err_put_net;
+		goto err_free;
 	gss_auth->service = gss_pseudoflavor_to_service(gss_auth->mech, flavor);
 	if (gss_auth->service == 0)
 		goto err_put_mech;
@@ -1101,8 +1099,6 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
 	rpcauth_destroy_credcache(auth);
 err_put_mech:
 	gss_mech_put(gss_auth->mech);
-err_put_net:
-	put_net_track(gss_auth->net, &gss_auth->ns_tracker);
 err_free:
 	kfree(gss_auth->target_name);
 	kfree(gss_auth);
@@ -1118,7 +1114,6 @@ gss_free(struct gss_auth *gss_auth)
 	gss_pipe_free(gss_auth->gss_pipe[0]);
 	gss_pipe_free(gss_auth->gss_pipe[1]);
 	gss_mech_put(gss_auth->mech);
-	put_net_track(gss_auth->net, &gss_auth->ns_tracker);
 	kfree(gss_auth->target_name);
 
 	kfree(gss_auth);

-- 
2.48.1


  parent reply	other threads:[~2025-03-17 21:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 20:59 [PATCH RFC 0/9] nfs/sunrpc: stop holding netns references in client-side NFS and RPC objects Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 1/9] sunrpc: transplant shutdown_client() to sunrpc module Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 2/9] lockd: add a helper to shut down rpc_clnt in nlm_host Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 3/9] lockd: don't #include debug.h from lockd.h Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 4/9] nfs: transplant nfs_server shutdown into a helper function Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 5/9] nfs: don't hold a reference to struct net in struct nfs_client Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 6/9] auth_gss: shut down gssproxy rpc_clnt in net pre_exit Jeff Layton
2025-03-17 20:59 ` Jeff Layton [this message]
2025-03-17 21:00 ` [PATCH RFC 8/9] sunrpc: don't hold a struct net reference in rpc_xprt Jeff Layton
2025-03-17 21:00 ` [PATCH RFC 9/9] sunrpc: don't upgrade passive net reference in xs_create_sock Jeff Layton
2025-03-17 21:28   ` Trond Myklebust
2025-03-17 21:36     ` Jeff Layton
2025-03-17 21:37       ` Trond Myklebust
2025-03-17 21:41         ` Jeff Layton
2025-03-17 21:35 ` [PATCH RFC 0/9] nfs/sunrpc: stop holding netns references in client-side NFS and RPC objects Trond Myklebust
2025-03-17 21:57   ` Jeff Layton
2025-03-17 22:11     ` Trond Myklebust
2025-03-18 11:30       ` Jeff Layton

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=20250317-rpc-shutdown-v1-7-85ba8e20b75d@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=bcodding@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    /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