[lkml]   [2004]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [linux-usb-devel] [PATCH] back out sysfs reference count change

> But that is impossible as has already been pointed out by Alan Stern.
> If a module creates a kobject, how can the module_exit() function ever
> be called if that kobject incremented the module reference count?

I just had a loooong discussion with Rusty on that subject, it's
indeed a nasty one. The problem is that the real solution is to
change the module unload semantics. Regardless of the count, module
exit should be called, and the actual unload (and eventually calling
an additional module "release" function) then should only happen
once the count is down to 0. That means that rmmod would block forever
if the driver is opened, but that is just something that needs to be

But that's not something we'll do for 2.6. For that to work, it also
need various subsystem unregister_* (netdev etc...) functions to not
error when the device is opened, just prevent new opens, and operate
asynchronously (freeing data structures on kobject release) etc...

> So what we do is any reference to the kobject grabbed by userspace
> causes the module reference count to go up. That fixes the issue for
> the most part (with the exception of the race that Maneesh has
> documented.)

Well.... Maybe, I still think it's dodgy, but probably fine for 2.6


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:02    [W:0.069 / U:1.108 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site