Subject: Re: netlink circular locking dependency

From: Patrick McHardy <[email-masked]>
Date: Tue, 17 Jun 2008 15:27:18 +0200

Jarek Poplawski wrote:
> On Tue, Jun 17, 2008 at 03:07:44PM +0200, Patrick McHardy wrote:
>> Jarek Poplawski wrote:
>>> On Tue, Jun 17, 2008 at 02:50:19PM +0200, Patrick McHardy wrote:
>>> ...
>>>> Thanks for testing. Unfortunately the module unload races look
>>>> more complicated to fix and I'm busy with other things, so it
>>>> would great if someone else could fix this.
>>> Patrick, I wonder if simply adding an additional mutex e.g.
>>> genl_lock_table() around all the rest (after your patch) genl_locks
>>> could be enough until some major rework. This should prevent any
>>> new races and there are no lockups, I guess?
>> Not sure I understand you correctly, where exactly would
>> this mutex be taken?
> 
> Around (before) each genl_lock(), so any change would need these two
> locks. genl_lock() alone would work like read lock (plus cb change).
> But, I can miss something... Of course, it's meant as a temporary
> solution, until Thomas does it right.

I guess that might work. But simply using module references to
prevent the module from going away while the mutex is not held
doesn't appear to be more complicated.