Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: James Pearson <jcpearson@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: nfsd thread limit and UDP ?
Date: Thu, 21 Feb 2019 10:20:26 -0500	[thread overview]
Message-ID: <20190221152026.GB23154@fieldses.org> (raw)
In-Reply-To: <CAK3fRr-y3YjX-8hMtutvpy=MQCyqH8YmRBwxyGJ4HmJQwsLyGw@mail.gmail.com>

On Thu, Feb 21, 2019 at 12:35:46PM +0000, James Pearson wrote:
> On Thu, 21 Feb 2019 at 04:18, J. Bruce Fields <bfields@fieldses.org> wrote:
> >
> > On Wed, Feb 20, 2019 at 11:28:53AM +0000, James Pearson wrote:
> > > On a very busy NFSv3 server (running CentOS 6), we recently upped the
> > > nfsd thread count to 1024 - but this caused client mount requests over
> > > UDP to fail.
> > >
> > > We configure all our clients to use TCP for NFS mounts, but the
> > > automounter (automountd) on MacOS (up to version MacOS 10.12) seeds a
> > > 'null call' to the NFS server over UDP before attempting the mount -
> > > but the server appears to ignore any UDP requests - and the automount
> > > fails
> >
> > By the way, you might also just turn off UDP.  (Start run rpc.nfsd with
> > the -U option.)  Hopefully MacOS can handle that case.
> 
> We tried that - but when we restarted nfs, some existing mounts hung
> (not sure why, as we should be just using TCP everywhere) ... although
> when tested on a test server, the MacOS automounter worked fine

It's probably not a good idea to turn off UDP while there are existing
mounts, even if the mounts are supposedly TCP.  At a guess, maybe some
one of the sideband protocols (NLM or NSM) is using UDP and that's
causing problems.

> I tried your patch - it doesn't apply 'as is' on a CentOS 6 kernel -
> but with a bit of manual hacking, I can get it to fit

Whoops, I missed at first that you were on an older kernel.

> However, the net/sunrpc/svcsock.c in these kernels has an extra call
> to svc_sock_setbufsize() :
> 
>         /* Initialize the socket */
>         if (sock->type == SOCK_DGRAM)
>                 svc_udp_init(svsk, serv);
>         else {
>                 /* initialise setting must have enough space to
>                  * receive and respond to one request.
>                  */
>                 svc_sock_setbufsize(svsk->sk_sock, 4 * serv->sv_max_mesg,
>                                         4 * serv->sv_max_mesg);
>                 svc_tcp_init(svsk, serv);
>         }
> 
> I tried replacing that svc_sock_setbufsize() with:
> 
>                 svc_sock_setbufsize(svsk, 4);
> 
> but that just caused the whole machine to lock up shortly after
> sunrpc.ko was loaded ...

Looks like it's trying to dereference svsk->xpt_server before
svc_tcp_init() has initialized it.

> However, things seem to work fine if I call a copy of the original
> svc_sock_setbufsize() at that point in the code with the original args
> ...
> 
> i.e. mounts over UDP (and MacOS automounts) now work with nfsd threads
> over 1017 (I tried 2048 ... and it worked)

OK, I think that's evidence enough that this overflow was the problem
you were hitting, so I'll send that patch upstream.

> Incidentally, I came across an old thread on this list that appears to
> be related to this issue (well, it mentions a 1020 thread limit and
> buffer size wraps in svc_sock_setbufsize() ???) :
> 
>  https://www.spinics.net/lists/linux-nfs/msg34927.html
> 
> ... but I'm not sure what the result of that was (nor if it is
> actually related to the issue here) ?

Yeah, see https://www.spinics.net/lists/linux-nfs/msg34932.html.  So, I
knew about this problem and even made a patch before and then somehow
dropped it.  I'm not sure how that happened.  Anyway, I have it queued
up for 5.1 now, so that shouldn't happen again.

--b.

      reply	other threads:[~2019-02-21 15:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 11:28 nfsd thread limit and UDP ? James Pearson
2019-02-20 17:44 ` J. Bruce Fields
2019-02-20 18:15   ` J. Bruce Fields
2019-02-21  4:18 ` J. Bruce Fields
2019-02-21 12:35   ` James Pearson
2019-02-21 15:20     ` J. Bruce Fields [this message]

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=20190221152026.GB23154@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jcpearson@gmail.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