[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1389900031.31367.420.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 16 Jan 2014 11:20:31 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Christoph Paasch <christoph.paasch@...ouvain.be>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH net v2] tcp: metrics: Avoid duplicate entries with the
same destination-IP
On Thu, 2014-01-16 at 20:01 +0100, Christoph Paasch wrote:
> 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@...ouvain.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.
>
> net/ipv4/tcp_metrics.c | 51 +++++++++++++++++++++++++++++++-------------------
> 1 file changed, 32 insertions(+), 19 deletions(-)
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Thanks !
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists