public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Jeff Layton <jlayton@redhat.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: still seeing single client NFS4ERR_DELAY / CB_RECALL
Date: Fri, 4 Sep 2020 18:01:04 -0400	[thread overview]
Message-ID: <20200904220104.GA7212@fieldses.org> (raw)
In-Reply-To: <A3CDC823-B550-4F7A-B592-4B8871131227@oracle.com>

On Mon, Aug 24, 2020 at 11:42:18AM -0400, Chuck Lever wrote:
> 
> 
> > On Aug 24, 2020, at 10:22 AM, Bruce Fields <bfields@fieldses.org> wrote:
> > 
> > On Mon, Aug 24, 2020 at 09:39:31AM -0400, Chuck Lever wrote:
> >> 
> >> 
> >>> On Aug 19, 2020, at 5:29 PM, Bruce Fields <bfields@fieldses.org> wrote:
> >>> 
> >>> On Tue, Aug 18, 2020 at 05:26:26PM -0400, Chuck Lever wrote:
> >>>> 
> >>>>> On Aug 17, 2020, at 6:20 PM, Bruce Fields <bfields@fieldses.org> wrote:
> >>>>> 
> >>>>> On Sun, Aug 16, 2020 at 04:46:00PM -0400, Chuck Lever wrote:
> >>>>> 
> >>>>>> In order of application:
> >>>>>> 
> >>>>>> 5920afa3c85f ("nfsd: hook nfsd_commit up to the nfsd_file cache")
> >>>>>> 961.68user 5252.40system 20:12.30elapsed 512%CPU, 2541 DELAY errors
> >>>>>> These results are similar to v5.3.
> >>>>>> 
> >>>>>> fd4f83fd7dfb ("nfsd: convert nfs4_file->fi_fds array to use nfsd_files")
> >>>>>> Does not build
> >>>>>> 
> >>>>>> eb82dd393744 ("nfsd: convert fi_deleg_file and ls_file fields to nfsd_file")
> >>>>>> 966.92user 5425.47system 33:52.79elapsed 314%CPU, 1330 DELAY errors
> >>>>>> 
> >>>>>> Can you take a look and see if there's anything obvious?
> >>>>> 
> >>>>> Unfortunately nothing about the file cache code is very obvious to me.
> >>>>> I'm looking at it....
> >>>>> 
> >>>>> It adds some new nfserr_jukebox returns in nfsd_file_acquire.  Those
> >>>>> mostly look like kmalloc failures, the one I'm not sure about is the
> >>>>> NFSD_FILE_HASHED check.
> >>>>> 
> >>>>> Or maybe it's the lease break there.
> >>>> 
> >>>> nfsd_file_acquire() always calls fh_verify() before it invokes nfsd_open().
> >>>> Replacing nfs4_get_vfs_file's nfsd_open() call with nfsd_file_acquire() adds
> >>>> almost 10 million fh_verify() calls to my test run.
> >>> 
> >>> Checking out the code as of fd4f83fd7dfb....
> >>> 
> >>> nfsd_file_acquire() calls nfsd_open_verified().
> >>> 
> >>> And nfsd_open() is basically just fh_verify()+nfsd_open_verified().
> >>> 
> >>> So it doesn't look like the replacement of nfsd_open() by
> >>> nfsd_file_acquire() should have changed the number of fh_verify() calls.
> >> 
> >> I see a lot more vfs_setlease() failures after fd4f83fd7dfb.
> >> check_conflicting_open() fails because "inode is open for write":
> >> 
> >> 1780         if (arg == F_RDLCK)
> >> 1781                 return inode_is_open_for_write(inode) ? -EAGAIN : 0;
> >> 
> >> The behavior on the wire is that the server simply doesn't hand out
> >> many delegations.
> >> 
> >> NFSv4 OPEN uses nfsd_file_acquire() now, but I don't see CLOSE
> >> releasing the cached file descriptor. Wouldn't that cached
> >> descriptor conflict with subsequent OPENs?
> > 
> > Could be, yes.
> > 
> > That also reminds me of this patch, did I already send it to you?
> 
> I don't have this one. I can try it.

No difference, I take it?

There could also be something wrong with nfsd4_check_conflicting_opens()
that's preventing delegations when it shouldn't.

There might also be some way fh_verify() could be smarter.  There's a
big comment there explaining why we repeat the permission checks each
time, but maybe we could keep a flag somewhere that tracks whether we
really need to call nfsd_setuser again.

Based on your and Frank's experiences I'm also sympathetic to the idea
that maybe the filehandle cache just gets in the way in the v4 case.

--b.

> > Author: J. Bruce Fields <bfields@redhat.com>
> > Date:   Fri Jul 17 18:54:54 2020 -0400
> > 
> >    nfsd: Cache R, RW, and W opens separately
> > 
> >    The nfsd open code has always kept separate read-only, read-write, and
> >    write-only opens as necessary to ensure that when a client closes or
> >    downgrades, we don't retain more access than necessary.
> > 
> >    Honestly, I'm not sure if that's completely necessary, but I'd rather
> >    stick to that behavior.
> > 
> >    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > 
> > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> > index 82198d747c4c..4b6f70e0d987 100644
> > --- a/fs/nfsd/filecache.c
> > +++ b/fs/nfsd/filecache.c
> > @@ -891,7 +891,7 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
> > 
> > 	hlist_for_each_entry_rcu(nf, &nfsd_file_hashtbl[hashval].nfb_head,
> > 				 nf_node, lockdep_is_held(&nfsd_file_hashtbl[hashval].nfb_lock)) {
> > -		if ((need & nf->nf_may) != need)
> > +		if (nf->nf_may != need)
> > 			continue;
> > 		if (nf->nf_inode != inode)
> > 			continue;
> 
> --
> Chuck Lever
> 
> 

  reply	other threads:[~2020-09-04 22:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-09 17:11 still seeing single client NFS4ERR_DELAY / CB_RECALL Chuck Lever
2020-08-09 20:27 ` Bruce Fields
2020-08-09 21:25   ` Bruce Fields
2020-08-10 18:21     ` Chuck Lever
2020-08-10 19:07       ` Bruce Fields
2020-08-10 20:01         ` Chuck Lever
2020-08-10 20:10           ` Bruce Fields
2020-08-11 13:31             ` Chuck Lever
2020-08-16 20:46               ` Chuck Lever
2020-08-17 22:20                 ` Bruce Fields
2020-08-18 15:27                   ` Chuck Lever
2020-08-18 21:26                   ` Chuck Lever
2020-08-18 21:49                     ` Bruce Fields
2020-08-19 13:26                       ` Chuck Lever
2020-08-19 21:29                     ` Bruce Fields
2020-08-20 12:56                       ` Chuck Lever
2020-08-24 13:39                       ` Chuck Lever
2020-08-24 14:22                         ` Bruce Fields
2020-08-24 15:42                           ` Chuck Lever
2020-09-04 22:01                             ` Bruce Fields [this message]
2020-09-04 22:27                               ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200904220104.GA7212@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox