Re: IPv4/IPv6 sysctl unregistration deadlock

From
Patrick McHardy <hidden>
Date
2009-03-02 11:22:04
Reply to
Patrick McHardy, 2009-03-02
Patrick McHardy wrote:
Stephen Hemminger wrote:
quoted
quoted
quoted
@@ -77,7 +77,9 @@ static ssize_t netdev_store(struct devic
     if (endp == buf)
         goto err;
 
-    rtnl_lock();
+    if (!rtnl_trylock())
+        return -ERESTARTSYS;
+
     if (dev_isalive(net)) {
         if ((ret = (*set)(net, new)) == 0)
             ret = len;
I can test this to see if it fixes my problem.  Are the above lines the
entirety of the patch?
yes
We should be able to avoid the restart looping in most cases,
we only need to do this while unregistration is in progress.
It doesn't seem to work. The idea was something like this:

static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
{
	struct inet6_dev *idev;
	struct net *net;

	net = (struct net *)table->extra2;
	if (p == &net->ipv6.devconf_dflt->forwarding)
		return 0;

	/* Unregistration in progress */
	idev = table->extra1;
	if (idev->cnf.sysctl == NULL)
		return -ERESTARTSYS;

	rtnl_lock();
...

but the process might have entered this function while the rtnl
is already held, but the unregistration hasn't been triggered yet.
So it would still deadlock.
Thread (25 messages) 25 messages, 6 authors, last reply 2009-03-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help