Skip to content

Commit

Permalink
nfsd: destroy percpu stats counters after reply cache shutdown
Browse files Browse the repository at this point in the history
Upon nfsd shutdown any pending DRC cache is freed. DRC cache use is
tracked via a percpu counter. In the current code the percpu counter
is destroyed before. If any pending cache is still present,
percpu_counter_add is called with a percpu counter==NULL. This causes
a kernel crash.
The solution is to destroy the percpu counter after the cache is freed.

Fixes: e567b98 (“nfsd: protect concurrent access to nfsd stats counters”)
Signed-off-by: Julian Schroeder <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
  • Loading branch information
JulianMarcusSchroeder1 authored and chucklever committed May 23, 2022
1 parent 6f6f84a commit fd5e363
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfsd/nfscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
struct svc_cacherep *rp;
unsigned int i;

nfsd_reply_cache_stats_destroy(nn);
unregister_shrinker(&nn->nfsd_reply_cache_shrinker);

for (i = 0; i < nn->drc_hashsize; i++) {
Expand All @@ -217,6 +216,7 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
rp, nn);
}
}
nfsd_reply_cache_stats_destroy(nn);

kvfree(nn->drc_hashtbl);
nn->drc_hashtbl = NULL;
Expand Down

0 comments on commit fd5e363

Please sign in to comment.