Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: christoph.paasch@uclouvain.be
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net v2] tcp: metrics: Avoid duplicate entries with the same destination-IP
Date: Fri, 17 Jan 2014 18:08:09 -0800 (PST)	[thread overview]
Message-ID: <20140117.180809.912704380920499561.davem@davemloft.net> (raw)
In-Reply-To: <1389898881-11393-1-git-send-email-christoph.paasch@uclouvain.be>

From: Christoph Paasch <christoph.paasch@uclouvain.be>
Date: Thu, 16 Jan 2014 20:01:21 +0100

> Because the tcp-metrics is an RCU-list, it may be that two
> soft-interrupts are inside __tcp_get_metrics() for the same
> destination-IP at the same time. If this destination-IP is not yet part of
> the tcp-metrics, both soft-interrupts will end up in tcpm_new and create
> a new entry for this IP.
> So, we will have two tcp-metrics with the same destination-IP in the list.
> 
> This patch checks twice __tcp_get_metrics(). First without holding the
> lock, then while holding the lock. The second one is there to confirm
> that the entry has not been added by another soft-irq while waiting for
> the spin-lock.
> 
> Fixes: 51c5d0c4b169b (tcp: Maintain dynamic metrics in local cache.)
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
> 
> v2: As requested by Eric D.: Check the cache twice. Once without holding the lock,
>     and then again while holding the lock. That way we avoid taking the lock
>     needlessly.

Looks great, applied and queued up for -stable, thanks.

      parent reply	other threads:[~2014-01-18  2:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 19:01 [PATCH net v2] tcp: metrics: Avoid duplicate entries with the same destination-IP Christoph Paasch
2014-01-16 19:20 ` Eric Dumazet
2014-01-18  2:08 ` David Miller [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=20140117.180809.912704380920499561.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=christoph.paasch@uclouvain.be \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@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