lkml.org 
[lkml]   [2007]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How should an exit routine wait for release() callbacks?
On Fri, 13 Apr 2007 11:24:58 -0400 (EDT),
Alan Stern <stern@rowland.harvard.edu> wrote:

> I have to admit, this is a puzzler. I'm beginning to think there should
> be two types of module references: Those which (like module dependency)
> will prevent rmmod from running, and those which (like the one here) would
> automatically be dropped by deregistration. Then every kobject could have
> an owner and could hold a reference of the second type to its owner until
> its release routine returns.

This sounds like the most promising idea yet.

We could make kobject_add() bump up this second-type refcount (since
from now on it may be looked up). kobject_get()/kobject_put() wouldn't
need to grab an extra reference (we already have refcounting for this
object in place). kobject_cleanup() could do something like:

struct module * kobject_owner = kobj->owner;
...
call_release();
put_second_module_refcount(kobject_owner);

combined with the module unloading code waiting after calling the exit
function until the second type refcount dropped to 0. This would make
sure that the module is not deleted until the last release function has
been called.

The module would stay in memory (not be unloaded) until the last
kobject created by the module is deleted, but I think that is just what
we want. At least this doesn't mean that the module blocks its own
unloading.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-16 10:53    [W:0.082 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site