From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khlebnikov Subject: Re: [PATCH] net: stop endless flood about dst entry refcount underflow or overflow Date: Tue, 14 Jul 2015 15:15:50 +0300 Message-ID: <55A4FD76.7050606@yandex-team.ru> References: <20150714114305.17434.53731.stgit@buzz> <1436875454.1374.9.camel@edumazet-glaptop2.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet To: Eric Dumazet Return-path: Received: from forward-corp1g.mail.yandex.net ([95.108.253.251]:58022 "EHLO forward-corp1g.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbbGNMPx (ORCPT ); Tue, 14 Jul 2015 08:15:53 -0400 In-Reply-To: <1436875454.1374.9.camel@edumazet-glaptop2.roam.corp.google.com> Sender: netdev-owner@vger.kernel.org List-ID: On 14.07.2015 15:04, Eric Dumazet wrote: > On Tue, 2015-07-14 at 14:43 +0300, Konstantin Khlebnikov wrote: >> Kernel generates a lot of warnings when dst entry reference counter >> overflows and becomes negative. This patch prints address of dst entry, >> its refcount and then resets reference counter to INT_MAX/2. >> >> That bug was seen several times at machines with outdated 3.10.y kernels. >> Most like it's already fixed in upstream. Anyway flood of that warnings >> completely kills machine and makes further debugging impossible. >> >> Signed-off-by: Konstantin Khlebnikov >> --- >> net/core/dst.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/net/core/dst.c b/net/core/dst.c >> index e956ce6d1378..2ed91082b3cf 100644 >> --- a/net/core/dst.c >> +++ b/net/core/dst.c >> @@ -284,7 +284,8 @@ void dst_release(struct dst_entry *dst) >> int newrefcnt; >> >> newrefcnt = atomic_dec_return(&dst->__refcnt); >> - WARN_ON(newrefcnt < 0); >> + if (WARN(newrefcnt < 0, "dst: %p refcnt: %d\n", dst, newrefcnt)) >> + atomic_set(&dst->__refcnt, INT_MAX / 2); >> if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) >> call_rcu(&dst->rcu_head, dst_destroy_rcu); >> } > > > WARN_ON_ONCE() if you want, but setting __refcnt like this is absolutely > a dirty hack. Simple warn-once will hide a lot of information which could be useful. Also dst entry leak is better than freeing actually active entry. > > > -- Konstantin