Skip to contentSkip to conversation

nfsd: shut down the NFSv4 state objects before the filecache

PATCH In review Jeff Layton 2 participants 3 messages Dec 22, 2022

Subsystems (2)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 nfsd: shut down the NFSv4 state objects before the filecache

Currently, we shut down the filecache before trying to clean up the stateids that depend on it. This leads to the kernel trying to free an nfsd_file twice, and a refcount overput on the nf_mark.

Change the shutdown procedure to tear down all of the stateids prior to shutting down the filecache.

---
 fs/nfsd/nfssvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfssvc.c +1 -1
index 56fba1cba3af..325d3d3f1211 100644
@@ -453,8 +453,8 @@ static void nfsd_shutdown_net(struct net *net)
 {
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
-	nfsd_file_cache_shutdown_net(net);
 	nfs4_state_shutdown_net(net);
+	nfsd_file_cache_shutdown_net(net);
 	if (nn->lockd_up) {
 		lockd_down(net);
 		nn->lockd_up = false;
Signature · 1 line
2.38.1
#1 lore raw
Quoted 34 lines · Jeff Layton

Currently, we shut down the filecache before trying to clean up the stateids that depend on it. This leads to the kernel trying to free an nfsd_file twice, and a refcount overput on the nf_mark.

Change the shutdown procedure to tear down all of the stateids prior to shutting down the filecache.

---
fs/nfsd/nfssvc.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfssvc.c +1 -1
index 56fba1cba3af..325d3d3f1211 100644
@@ -453,8 +453,8 @@ static void nfsd_shutdown_net(struct net *net)
 {
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
-	nfsd_file_cache_shutdown_net(net);
 	nfs4_state_shutdown_net(net);
+	nfsd_file_cache_shutdown_net(net);
 	if (nn->lockd_up) {
 		lockd_down(net);
 		nn->lockd_up = false;
Signature · 1 line
2.38.1

Hi Jeff, seems sensible. May I add:

Fixes 5e113224c17e ("nfsd: nfsd_file cache entries should be per net namespace")

--
Chuck Lever

author maintainer
#2 lore raw
Quoted 36 lines · Chuck Lever III
Quoted 33 lines · Jeff Layton

Currently, we shut down the filecache before trying to clean up the stateids that depend on it. This leads to the kernel trying to free an nfsd_file twice, and a refcount overput on the nf_mark.

Change the shutdown procedure to tear down all of the stateids prior to shutting down the filecache.

---
fs/nfsd/nfssvc.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfssvc.c +1 -1
index 56fba1cba3af..325d3d3f1211 100644
@@ -453,8 +453,8 @@ static void nfsd_shutdown_net(struct net *net)
 {
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
-	nfsd_file_cache_shutdown_net(net);
 	nfs4_state_shutdown_net(net);
+	nfsd_file_cache_shutdown_net(net);
 	if (nn->lockd_up) {
 		lockd_down(net);
 		nn->lockd_up = false;
Signature · 1 line
2.38.1

Hi Jeff, seems sensible. May I add:

Quoted 2 lines
Fixes 5e113224c17e ("nfsd: nfsd_file cache entries should be per net namespace")

Yes, thanks.

Signature · 1 line
Jeff Layton <[email protected]>