From: Greg KH <gregkh@suse.de>
To: Roland Dreier <rdreier@cisco.com>
Cc: Andreas Mohr <andi@lisas.de>, Kay Sievers <kay.sievers@vrfy.org>,
linux-kernel@vger.kernel.org, rusty@rustcorp.com.au
Subject: Re: [BUG] git 2.6.31-rc3'ish: "<kobject> does not have a release() function, it is broken and must be fixed."
Date: Thu, 6 Aug 2009 16:58:52 -0700 [thread overview]
Message-ID: <20090806235852.GA29688@suse.de> (raw)
In-Reply-To: <adaiqh0ec8c.fsf@cisco.com>
On Thu, Aug 06, 2009 at 04:47:31PM -0700, Roland Dreier wrote:
>
> > Kay, we were cleaning up the kobject name stuff then, and we thought
> > that this release function wasn't used anymore. But in looking at the
> > code, I can't see where the kobject is actually freed. What am I
> > missing?
>
> the kobject in question is freed at
>
> free_module() ->
> mod_kobject_remove() ->
> mod_sysfs_fini() ->
> kobject_put(&mod->mkobj.kobj);
>
> (in kernel/module.c)
Ah, that makes sense.
This is because we can't "free" the kobject here, because the kobject is
part of the larger struct module structure. And the kobject is not
being used as a reference count for the whole structure, it's being used
just to create the sysfs directories.
So we can't have a release function, because if we did, it would have to
do nothing.
And yes, this isn't "correct" and is what I make fun of lots of people
for doing all the time now. But Rusty did this a long time ago before I
realized it :)
Patches to fix this up "properly" are gladly accepted, just watch out,
that code path is nasty.
So yes, the warning when kobject debugging is enabled is correct, that
kobject usage is "wrong" and should be fixed one of these days.
I'll add it to the end of my long TODO list :(
thanks,
greg k-h
prev parent reply other threads:[~2009-08-07 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 18:12 [BUG] git 2.6.31-rc3'ish: "<kobject> does not have a release() function, it is broken and must be fixed." Andreas Mohr
2009-07-16 22:55 ` Greg KH
2009-08-06 20:28 ` Roland Dreier
2009-08-06 20:50 ` Andreas Mohr
2009-08-06 22:32 ` Greg KH
2009-08-06 23:47 ` Roland Dreier
2009-08-06 23:58 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090806235852.GA29688@suse.de \
--to=gregkh@suse.de \
--cc=andi@lisas.de \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdreier@cisco.com \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox