* [PATCH] nfsd: shut down the NFSv4 state objects before the filecache
@ 2022-12-22 14:51 Jeff Layton
2022-12-22 14:55 ` Chuck Lever III
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2022-12-22 14:51 UTC (permalink / raw)
To: chuck.lever; +Cc: linux-nfs, Wang Yugui
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.
Reported-and-Tested-by: Wang Yugui <wangyugui@e16-tech.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/nfssvc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 56fba1cba3af..325d3d3f1211 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -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;
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: shut down the NFSv4 state objects before the filecache
2022-12-22 14:51 [PATCH] nfsd: shut down the NFSv4 state objects before the filecache Jeff Layton
@ 2022-12-22 14:55 ` Chuck Lever III
2022-12-22 15:10 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever III @ 2022-12-22 14:55 UTC (permalink / raw)
To: Jeff Layton; +Cc: Linux NFS Mailing List, Wang Yugui
> On Dec 22, 2022, at 9:51 AM, Jeff Layton <jlayton@kernel.org> wrote:
>
> 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.
>
> Reported-and-Tested-by: Wang Yugui <wangyugui@e16-tech.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/nfsd/nfssvc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index 56fba1cba3af..325d3d3f1211 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -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;
> --
> 2.38.1
>
Hi Jeff, seems sensible. May I add:
Fixes: 5e113224c17e ("nfsd: nfsd_file cache entries should be per net namespace")
--
Chuck Lever
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: shut down the NFSv4 state objects before the filecache
2022-12-22 14:55 ` Chuck Lever III
@ 2022-12-22 15:10 ` Jeff Layton
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2022-12-22 15:10 UTC (permalink / raw)
To: Chuck Lever III; +Cc: Linux NFS Mailing List, Wang Yugui
On Thu, 2022-12-22 at 14:55 +0000, Chuck Lever III wrote:
>
> > On Dec 22, 2022, at 9:51 AM, Jeff Layton <jlayton@kernel.org> wrote:
> >
> > 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.
> >
> > Reported-and-Tested-by: Wang Yugui <wangyugui@e16-tech.com>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/nfsd/nfssvc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> > index 56fba1cba3af..325d3d3f1211 100644
> > --- a/fs/nfsd/nfssvc.c
> > +++ b/fs/nfsd/nfssvc.c
> > @@ -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;
> > --
> > 2.38.1
> >
>
> Hi Jeff, seems sensible. May I add:
>
> Fixes: 5e113224c17e ("nfsd: nfsd_file cache entries should be per net namespace")
>
Yes, thanks.
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-22 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 14:51 [PATCH] nfsd: shut down the NFSv4 state objects before the filecache Jeff Layton
2022-12-22 14:55 ` Chuck Lever III
2022-12-22 15:10 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).