nfsd: destroy percpu stats counters after reply cache shutdown
authorJulian Schroeder <jumaco@amazon.com>
Mon, 23 May 2022 18:52:26 +0000 (18:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:12 +0000 (10:23 +0200)
commit075564ed4089353557d2e3f5d0fba39b52181aff
treeb72464c1a3591f1cdb74f6f1998a3a8ebf8f6b94
parent5289795824b77489803b0802cd9edc13824a2d0b
nfsd: destroy percpu stats counters after reply cache shutdown

[ Upstream commit fd5e363eac77ef81542db77ddad0559fa0f9204e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/nfscache.c