Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Jan 2003 02:26:17 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        tlambert2@mindspring.com
Cc:        nate@root.org, current@FreeBSD.ORG, net@FreeBSD.ORG
Subject:   Re: Proper -current if_attach locking?
Message-ID:  <20030107.022617.23700606.imp@bsdimp.com>
In-Reply-To: <20030107.021428.126452776.imp@bsdimp.com>
References:  <20030107.001924.02080410.imp@bsdimp.com> <3E1A87A8.F9C079F@mindspring.com> <20030107.021428.126452776.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I was right (and I think you are too).  We do have lock issues.

dc_attach does approximately:

DC_LOCK
ether_attach()	(which does a IFNET_WLOCK/UNLOCK pair)
DC_UNLOCK

(this sets the lock order to be DC_LOCK, IFNET_WLOCK).

However in if_slowtimo we have:

if_slowtimo(arg)
{
...	IFNET_RLOCK();
...		if (ifp->if_watchdog)
			(*ifp->if_watchdog)(ifp);
...	IFNET_RUNLOCK();
}

and dc_watchdog does a DC_LOCK/UNLOCK pair).  This is a Lock Order
Reversal, and not a LotR :-)

What's worse is that dc_intr does:

DC_LOCK
...dc_start (which calls IF_PREPEND which does the IFNET_LOCK/UNLOCK thing)
DC_UNLOCK

So even if we remove the one from attach, it looks like we have others
lurking in the code.

Either that, or it is too late for me to be looking at code like this
:-(

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030107.022617.23700606.imp>