> On Aug 9, 2020, at 5:25 PM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > > On Sun, Aug 09, 2020 at 04:27:39PM -0400, Bruce Fields wrote: >> On Sun, Aug 09, 2020 at 01:11:36PM -0400, Chuck Lever wrote: >>> Hi Bruce- >>> >>> I noticed that one of my tests takes about 4x longer on NFSv4.0 than >>> it does on NFSv3 or NFSv4.[12]. As an initial stab at the cause, I'm >>> seeing lots of these: >> >> Oops, looks obvious in retrospect, but I didn't think of it. >> >> In the 4.1+ case, sessions mean that we know which client every >> operation comes from. >> >> In the 4.0 case that only works for operations that take a stateid or >> something else we can link back to a client. >> >> That means in the 4.0 case delegations are less useful, since they have >> to be broken on any (non-truncating) setattr, any link/unlink, etc., >> even if the operation comes from the same client--the server doesn't >> have a way to know that. >> >> Maybe the change to give out read delegations even on write opens >> probably just isn't worth in the 4.0 case. > > Untested, but maybe this?--b. > > commit 2102ac0b68f3 > Author: J. Bruce Fields <bfields@xxxxxxxxxx> > Date: Sun Aug 9 17:11:59 2020 -0400 > > nfsd4: don't grant delegations on 4.0 create opens > > Chuck reported a major slowdown running the git regression suite over > NFSv4.0. > > In the 4.0 case, the server has no way to identify which client most > metadata-modifying operations come from. So, for example, the common > pattern of a a setattr is likely to result in an immediate break in the > 4.0 case. > > It's probably not worth giving out delegations on 4.0 creates. > > Reported-by: Chuck Lever <chuck.lever@xxxxxxxxxx> > Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx> > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index fdba971d06c3..ce2d052b3f64 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -5096,6 +5096,16 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, > goto out_no_deleg; > if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED)) > goto out_no_deleg; > + /* > + * In the absence of sessions, most operations > + * that modify metadata (like setattr) can't > + * be linked to the client sending them, so > + * will result in a delegation break. That's > + * especially likely for create opens: > + */ > + if (clp->cl_minorversion == 0 && > + open->op_create == NFS4_OPEN_CREATE) > + goto out_no_deleg; > break; > default: > goto out_no_deleg; For these results I've switched to sec=sys so the test completes faster. NFSv3/sys: 953.37user 5101.96system 14:13.78elapsed 709%CPU (0avgtext+0avgdata 107160maxresident)k NFSv4.1/sys: 953.64user 5202.27system 17:54.51elapsed 572%CPU (0avgtext+0avgdata 107204maxresident)k NFSv4.0/sys unpatched: 965.44user 5406.75system 36:10.72elapsed 293%CPU (0avgtext+0avgdata 107252maxresident)k NFSv4.0/sys with fix: 968.38user 5359.18system 30:50.38elapsed 341%CPU (0avgtext+0avgdata 107140maxresident)k -- Chuck Lever