public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Patrick Mochel <mochel@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: Bug (?) in subsystem kset refcounts
Date: Sat, 8 Nov 2003 20:29:37 -0800	[thread overview]
Message-ID: <20031109042936.GA8583@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0311082209330.7127-100000@netrider.rowland.org>

On Sat, Nov 08, 2003 at 10:20:03PM -0500, Alan Stern wrote:
> I hesitate to say this is definitely a bug, since it might be intended 
> behavior.  But it is rather strange.
> 
> Subsystems included an embedded kset, which itself includes an embedded 
> kobject and so is subject to reference counting.  Whenever a kobject 
> belonging to the kset is destroyed, the kset's reference count is 
> decremented.  However, kobjects can be added to a kset via the three 
> macros
> 
> 	kobj_set_kset_s, kset_set_kset_s, and subsys_set_kset
> 
> and these do _not_ increment the kset's reference count.  As a result, the 
> reference count only goes down, not up, quickly becoming negative.

See the patch that went into Linus's tree yesterday to fix where this
would happen.

But yes, usages of these macros is touchy, and we need to get it
correct.  Your proposed patch will never allow the reference counts to
go back to zero.

Also, notice that when the kobject is initialized, the kset set by these
macros is then incremented.

thanks,

greg k-h

  reply	other threads:[~2003-11-09  4:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-09  3:20 Bug (?) in subsystem kset refcounts Alan Stern
2003-11-09  4:29 ` Greg KH [this message]
2003-11-09 17:01   ` Alan Stern
2003-11-09 19:42     ` Greg KH

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=20031109042936.GA8583@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=stern@rowland.harvard.edu \
    /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