[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <460D178F.4000500@gmail.com>
Date: Fri, 30 Mar 2007 22:58:39 +0900
From: Tejun Heo <htejun@...il.com>
To: Cornelia Huck <cornelia.huck@...ibm.com>
CC: gregkh@...e.de, hugh@...itas.com, dmitry.torokhov@...il.com,
oneukum@...e.de, maneesh@...ibm.com, rpurdie@...ys.net,
James.Bottomley@...elEye.com, Jeff Garzik <jgarzik@...ox.com>,
lkml <linux-kernel@...r.kernel.org>,
"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
SCSI Mailing List <linux-scsi@...r.kernel.org>
Subject: Re: [RFD driver-core] Lifetime problems of the current driver model
Cornelia Huck wrote:
> On Fri, 30 Mar 2007 22:19:52 +0900,
> Tejun Heo <htejun@...il.com> wrote:
>
>>> Shouldn't getting/putting the module refcount be solely done in
>>> kobject.c? Grab the module reference when the kobject is created and
>>> release the module reference in kobject_cleanup() after the release
>>> function has been called. This doesn't make kobject_get() heavier, and
>>> it ensures we don't delete the module until after the last kobject it is
>>> supposed to clean up has been released.
>> If we do that, we wouldn't be able to unload a module if there is any
>> kobject referencing it even when the node has no openers, so no easy way
>> out there. :-(
>
> But we must not unload the module when there is still a kobject around
> referencing a release function in the module, or we will oops if the
> kobject is finally released. If needed, the module must clean up its
> kobjects in its exit function.
It's a little bit more convoluted than that. Module reference count of
zero doesn't indicate that there is no one referencing the module. It
just means that the module can be unloaded. ie. There still can be any
number of kobjects with release function backed by the module but as
long as all of them can be deleted and released by module exit function,
the module is unloadable at that point.
IOW, module reference count does not count number of objects depending
on the module. It counts the number of active usages of those objects.
--
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists