[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140117.180809.912704380920499561.davem@davemloft.net>
Date: Fri, 17 Jan 2014 18:08:09 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: christoph.paasch@...ouvain.be
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net v2] tcp: metrics: Avoid duplicate entries with the
same destination-IP
From: Christoph Paasch <christoph.paasch@...ouvain.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@...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.
Looks great, applied and queued up for -stable, 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