Re: [PATCH v2 3/3] nfsd: keep a tally of RECLAIM_COMPLETE operations when using nfsdcld

Scott Mayhew
2018-12-19T22:01:20Z

On Wed, 19 Dec 2018, J. Bruce Fields wrote:

> On Tue, Dec 18, 2018 at 09:29:26AM -0500, Scott Mayhew wrote:
> > diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> > index 89c2a27956d0..ae74814b2397 100644
> > --- a/fs/nfsd/nfs4recover.c
> > +++ b/fs/nfsd/nfs4recover.c
> > @@ -1251,6 +1251,7 @@ nfsd4_cld_grace_done(struct nfsd_net *nn)
> > free_cld_upcall(cup);
> > out_err:
> > nfs4_release_reclaim(nn);
> > + atomic_set(&nn->nr_reclaim_complete, 0);
> > if (ret)
> > printk(KERN_ERR "NFSD: Unable to end grace period: %d\n", ret);
> > }
> > @@ -1270,6 +1271,8 @@ nfs4_cld_state_init(struct net *net)
> > for (i = 0; i < CLIENT_HASH_SIZE; i++)
> > INIT_LIST_HEAD(&nn->reclaim_str_hashtbl[i]);
> > nn->reclaim_str_hashtbl_size = 0;
> > + nn->track_reclaim_completes = true;
> > + atomic_set(&nn->nr_reclaim_complete, 0);
> >
> > return 0;
> > }
> ...
> > @@ -1318,6 +1322,7 @@ nfsd4_cld_tracking_exit(struct net *net)
> > struct nfsd_net *nn = net_generic(net, nfsd_net_id);
> >
> > nfs4_release_reclaim(nn);
> > + atomic_set(&nn->nr_reclaim_complete, 0);
> > nfsd4_remove_cld_pipe(net);
> > nfs4_cld_state_shutdown(net);
> > }
>
> We're initializing nr_reclaim_complete in 3 different places, probably
> only one of those is really necessary?

Yes, only the one in nfs4_cld_state_init() is really necessary. If the
ability to put a running server into grace is ever added, then I think
the counter would need to be reset there too.

-Scott
>
> --b.