Subject: Re: netlink locking warnings in 2.6.21-rc7-mm1

From: Andrew Morton <[email-masked]>
Date: Tue, 24 Apr 2007 14:26:40 -0700

On Tue, 24 Apr 2007 14:20:08 -0700 (PDT) David Miller <[email-masked]> wrote:

> From: Andrew Morton <[email-masked]>
> Date: Tue, 24 Apr 2007 12:42:50 -0700
> 
> > void debug_mutex_unlock(struct mutex *lock)
> > {
> > 	if (unlikely(!debug_locks))
> > 		return;
> > 
> > -->	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
> > 	DEBUG_LOCKS_WARN_ON(lock->magic != lock);
> > 
> > so it's complaining that cb_mutex is being release by a thread other than
> > the one which acquired it.  I'm unable to reproduce it with their config,
> > naturally.
> 
> Is it illegal to sleep with a mutex held?

Nope.  Otherwise we'd use spinlocks everywhere ;)

> I think I see what might be the problem, nlk->cb_mutex is set
> to "rtnl_mutex" and this is used for other purposes in various
> code paths here, maybe there is a double mutex_unlock() or
> similar due to that?

ooh, this might explain my mysterious ASSERT_RTNL failures, perhaps.
Am ready to test a patch.