All of lore.kernel.org
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
To: "Jeff Layton" <jlayton@redhat.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] sunrpc: make warning in svc_check_conn_limits() more generic
Date: Thu, 16 Oct 2008 13:08:22 +1100 (EST)	[thread overview]
Message-ID: <fdcfe437d88ecb7d49ea4b2729407dc5.squirrel@neil.brown.name> (raw)
In-Reply-To: <20081015205118.14de4611-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>

On Thu, October 16, 2008 11:51 am, Jeff Layton wrote:
> On Wed, 15 Oct 2008 16:21:02 -0400
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
>
>> On Wed, Oct 15, 2008 at 08:14:57AM -0400, Jeff Layton wrote:
>> > From the descriptions in those commits, it looks like the check
>> > in svc_check_conn_limits was intended to prevent messages from too
>> > many sockets overloading the receive buffers.
>>
>> Aren't the receive buffers per-connection?
>>
>> --b.
>>
>
> Oof...you're quite right. I misunderstood the code earlier. Thinking
> this through a bit more...
>
> I suppose the main worry is that we have a service with too few
> threads and a ton of sockets. We end up in a situation where the
> receive buffers aren't getting processed quickly enough and connections
> start stalling out.
>
> I suppose the only real remedy for that is to increase the number of
> threads, but that's not an option for services like lockd. So maybe
> ignoring this check on single-threaded services is the way to go after
> all? I don't see a way to make this auto-tuning based on memory since
> that doesn't seem to be what the check is intended to help...

Don't expect too much of the "intent" of this limit.
I think it just "seemed like a good idea at the time" with some idea that
a denial of service attack could swamp the NFS server with connections
if we didn't actively close some when there was a large number of them.

The patch which added the test is
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=afdb4fa2b04a7e90e0746bc3d031a552656c7709

which says nothing about why.

I found an old Email with a list of things I needed to do to be happy
with TCP support and it included:


- Guard against denial of service - impose some limit on the number of
  incoming connections, and start randomly dropping connections when
  this limit is exceeded.

Which again isn't very helpful.

I certainly wasn't thinking about the possibility of lockd getting
lots of connections despite being a single-thread service.

Maybe we should use
 current->signal->rlim[RLIMIT_NOFILE].rlim_cur
as a minimum limit.  i.e if the number of connections is below this,
allow the connection.  If the number of connections is below the
currently calculated value, also allow the connection.
Only reject if the number is greater than both of these limits.

One problem there is that I don't think you can adjust the RLIMIT_NOFILE
limit for nfsd. It (it think) shares this number with init and all other
kernel threads.

NeilBrown


  parent reply	other threads:[~2008-10-16  2:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 13:12 [PATCH] sunrpc: make warning in svc_check_conn_limits() more generic Jeff Layton
2008-09-24 21:57 ` J. Bruce Fields
2008-09-25 20:23   ` Jeff Layton
     [not found]     ` <20080925162315.6f29d092-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-10-15 12:14       ` Jeff Layton
     [not found]         ` <20081015081457.56ef3778-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-10-15 20:21           ` J. Bruce Fields
2008-10-16  0:51             ` Jeff Layton
     [not found]               ` <20081015205118.14de4611-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-10-16  2:08                 ` NeilBrown [this message]
     [not found]                   ` <fdcfe437d88ecb7d49ea4b2729407dc5.squirrel-eq65iwfR9nKIECXXMXunQA@public.gmane.org>
2008-10-16 13:48                     ` Jeff Layton
2008-10-17  0:14                       ` Neil Brown
     [not found]                         ` <18679.55525.146056.752860-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-10-17 14:55                           ` William A. (Andy) Adamson
     [not found]                             ` <89c397150810170755r578ae723o89ab7b475b894704-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-17 18:29                               ` J. Bruce Fields
2008-10-17 18:20                           ` J. Bruce Fields
2008-10-17 18:27                             ` Jeff Layton
     [not found]                               ` <20081017142753.6485571f-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-10-17 18:29                                 ` J. Bruce Fields

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=fdcfe437d88ecb7d49ea4b2729407dc5.squirrel@neil.brown.name \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.