netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IPv4/IPv6 sysctl unregistration deadlock
@ 2009-02-25  5:23 Patrick McHardy
  2009-02-25  6:19 ` Herbert Xu
  0 siblings, 1 reply; 25+ messages in thread
From: Patrick McHardy @ 2009-02-25  5:23 UTC (permalink / raw)
  To: Linux Netdev List; +Cc: Herbert Xu

Ben Greear reported sporadically hanging ip processes when adding or
removing MACVLAN devices, which seem to be caused by a race between
sysctl handling and device notifiers.

What is happening is:

Process 1:

- "ip" deletes a macvlan device (or any other kind of device gets
   removed for whatever reason)
- netdev notifier chain notifies IPv6 addrconf while holding the RTNL

Process 2:

- a different process writes something to /proc/sys/net/ipv6/forwarding
- sysctl table is marked as busy, addrconf_sysctl_forward() is invoked
- tries to take rtnl, waits for process 1

Process 1:

- IPv6 begins sysctl unregistration, which is deferred using a
   completion until the table is not busy anymore (=> waiting for
   process 2)

At this point both processes are deadlocked. Judging by a quick look,
IPv4 seems to have the exact same problem.

An easy fix would be to keep track of whether sysctl unregistration
is in progress in IPv4/IPv6 and ignore new requests from that point
on. Its not very elegant though, so I was wondering whether anyone
has a better suggestion.


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-03-08  3:37 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25  5:23 IPv4/IPv6 sysctl unregistration deadlock Patrick McHardy
2009-02-25  6:19 ` Herbert Xu
2009-02-25  6:23   ` Patrick McHardy
2009-02-25  7:18     ` Patrick McHardy
2009-02-25  8:43       ` Herbert Xu
2009-02-26  6:06         ` Eric W. Biederman
2009-02-26  6:10         ` Eric W. Biederman
2009-02-26  6:22           ` Herbert Xu
2009-02-26  7:18             ` Eric W. Biederman
2009-02-26 16:49               ` Stephen Hemminger
2009-02-26 19:01                 ` Eric W. Biederman
2009-02-26 20:24                   ` Stephen Hemminger
2009-02-27  0:59                 ` Herbert Xu
2009-02-27  1:25                   ` Stephen Hemminger
2009-02-27 18:26                 ` Ben Greear
2009-02-27 18:38                   ` Stephen Hemminger
2009-03-02 11:07                     ` Patrick McHardy
2009-03-02 11:21                       ` Patrick McHardy
2009-03-02 22:11                     ` Ben Greear
2009-03-02 22:20                       ` Patrick McHardy
2009-03-02 22:47                         ` David Miller
2009-03-02 23:03                           ` Patrick McHardy
2009-03-03  8:48                             ` David Miller
2009-03-08  3:36                               ` Eric W. Biederman
2009-02-26 16:55       ` Stephen Hemminger

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).