Subject: Re: mutex WARNING while running ip from iproute2 package

From: Patrick McHardy <[email-masked]>
Date: Thu, 24 Apr 2008 05:12:14 +0200

David Miller wrote:
> From: Denys Fedoryshchenko <[email-masked]>
> Date: Sun, 20 Apr 2008 17:57:09 +0300
> 
>> Just noticed warning while upgrading and loading 2.6.25.
>> Configuration a bit complicated, so it is difficult to tell which command trigger it.
>> If it is required, i can spend time and will try to find it.
>>
>> It is QEMU machine, non-smp.
> 
> Thanks for your report.
> 
> Patrick, it looks pretty simple, if you bring up a macvlan device using
> rtnetlink, we take the RTNL lock recursively via the call to
> dev_unicast_add() performed by the macvlan open method.
> 
> Can you have a look?

Sure. This seems to be the bogus ASSERT_RTNL warning caused
by mutex_trylock() while holding a spinlock. The warning
itself is harmless, since we're already holding the RTNL,
mutex_trylock won't succeed.

Herbert suggested to store address updates in atomic context
on a temporary list and do the actual update in process
context. This seems like a good idea to simplify the address
list locking, unfortunately I didn't manage to take care of
this yet. An alternative fix to silent the bogus warning would
be to use mutex_is_locked in ASSERT_RTNL, but Herbert didn't
like that idea.