lkml.org 
[lkml]   [2014]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kobject: provide kobject_put_wait to fix module unload race
On Tue, Jan 07 2014 at  3:16pm -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> On Tue, 7 Jan 2014, Mike Snitzer wrote:
>
> > I've staged your patch in linux-next for 3.14, see:
> > http://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=af7b1e5c767fc895788c971c8f4686402ac8344f
>
> Looking at this patch, I realize that it is buggy too. If module unload
> happens at this point (after the completion is signaled, but before the
> release function returns), it crashes.
>
> static void dm_kobject_release(struct kobject *kobj)
> {
> complete(dm_get_completion_from_kobject(kobj));
> >========== module unload here ===============<
> }

That race isn't a surprise, thought you pointed it out earlier in this
thread? Anyway, I'm inclined to keep the racey patch staged in
linux-dm.git until the stalemate with gregkh is resolved. DM is no
worse than other code that follows this same wait for completion
pattern.

> The patch that I sent initially in this thread doesn't have this bug
> because the completion is signaled in non-module code.
>
> That goes back to my initial claim - it is impossible to use the kobject
> interface correctly! But if Greg doesn't want a patch that fixes the
> kobject interface, I don't really know what to do about it.

Right, I'm missing what is wrong with your proposed kobject_put_wait
interface.

Greg, can you please establish that you understand the problem, and
existing kobject patterns, before you dismiss a fix?


\
 
 \ /
  Last update: 2014-01-08 01:01    [W:0.042 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site