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: e567b98ce9a4b (“nfsd: protect concurrent access to nfsd stats counters”)
Signed-off-by: Julian Schroeder <jumaco@amazon.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
        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++) {
                                                                        rp, nn);
                }
        }
+       nfsd_reply_cache_stats_destroy(nn);
 
        kvfree(nn->drc_hashtbl);
        nn->drc_hashtbl = NULL;