From: Daniel Borkmann <daniel@iogearbox.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Jiri Pirko <jiri@resnulli.us>, Cong Wang <cwang@twopensource.com>,
David Miller <davem@davemloft.net>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Thomas Graf <tgraf@suug.ch>, Scott Feldman <sfeldma@gmail.com>,
Network Development <netdev@vger.kernel.org>
Subject: Re: rtnl_mutex deadlock?
Date: Thu, 06 Aug 2015 16:50:39 +0200 [thread overview]
Message-ID: <55C3743F.1010900@iogearbox.net> (raw)
In-Reply-To: <20150806003026.GA12785@gondor.apana.org.au>
On 08/06/2015 02:30 AM, Herbert Xu wrote:
> On Wed, Aug 05, 2015 at 08:59:07PM +0200, Daniel Borkmann wrote:
>>
>> Here's a theory and patch below. Herbert, Thomas, does this make any
>> sense to you resp. sound plausible? ;)
>
> It's certainly possible. Whether it's plausible I'm not so sure.
> The netlink hashtable is unlimited in size. So it should always
> be expanding, not rehashing. The bug you found should only affect
> rehashing.
>
>> I'm not quite sure what's best to return from here, i.e. whether we
>> propagate -ENOMEM or instead retry over and over again hoping that the
>> rehashing completed (and no new rehashing started in the mean time) ...
>
> Please use something other than ENOMEM as it is already heavily
> used in this context. Perhaps EOVERFLOW?
Okay, I'll do that.
> We should probably add a WARN_ON_ONCE in rhashtable_insert_rehash
> since two concurrent rehashings indicates something is going
> seriously wrong.
So, if I didn't miss anything, it looks like the following could have
happened: the worker thread, that is rht_deferred_worker(), itself could
trigger the first rehashing, e.g. after shrinking or expanding (or also
in case none of both happen).
Then, in __rhashtable_insert_fast(), I could trigger an -EBUSY when I'm
really unlucky and exceed the ht->elasticity limit of 16. I would then
end up in rhashtable_insert_rehash() to find out there's already one
ongoing and thus, I'm getting -EBUSY via __netlink_insert().
Perhaps that is what could have happened? Seems rare though, but it was
also only seen rarely so far ...
next prev parent reply other threads:[~2015-08-06 14:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 15:48 rtnl_mutex deadlock? Linus Torvalds
2015-08-05 5:31 ` Cong Wang
2015-08-05 7:43 ` Jiri Pirko
2015-08-05 8:44 ` Linus Torvalds
2015-08-05 18:59 ` Daniel Borkmann
2015-08-06 0:30 ` Herbert Xu
2015-08-06 14:50 ` Daniel Borkmann [this message]
2015-08-06 22:39 ` Daniel Borkmann
2015-08-06 23:42 ` Herbert Xu
2015-08-06 23:41 ` Herbert Xu
2015-08-06 23:58 ` Daniel Borkmann
2015-08-07 0:00 ` Herbert Xu
2015-08-08 17:22 ` Thomas Graf
2015-08-06 5:19 ` Herbert Xu
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=55C3743F.1010900@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=cwang@twopensource.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=sfeldma@gmail.com \
--cc=tgraf@suug.ch \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).