Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Mark Haverkamp <markh@osdl.org>,
	Mark Salyzyn <mark_salyzyn@adaptec.com>,
	Ben Collins <bcollins@debian.org>
Subject: Re: [PATCH 3/8] aacraid: handle AIF hotplug events
Date: Sat, 10 Sep 2005 12:50:50 -0500	[thread overview]
Message-ID: <1126374650.4813.56.camel@mulgrave> (raw)
In-Reply-To: <4323197D.7070401@s5r6.in-berlin.de>

On Sat, 2005-09-10 at 19:35 +0200, Stefan Richter wrote:
> James Bottomley wrote:
> > scsi_add_device() returns an sdev on
> > success with the refcount bumped up for you.  If you don't do a put,
> > you'll be stuck with a device you can't get rid of.
> > 
> > However, all other users of scsi_add_device() make the same mistake ...
> 
> Sbp2 was fixed recently, thanks to your advice. (Although the fix did 
> not make it into Linus' tree yet.)

Yes, I forgot about that, we will eventually have one correct user ;-)

> > I'll apply this patch and fix the API to return zero or error and not
> > bump the sdev refcount.
> 
> If you will do this, the now correct scsi_device_put() will become not 
> only incorrect but even dangerous, won't it?

I've cc'd you on the patch (and it fixes sbp2 as it currently stands in
the Linus tree, but it would conflict with the fix you have pending).
It basically makes scsi_add_device return an int rather than a device
pointer, so the compiler will now flag if something actually tries to
use the return as a pointer.

James



  reply	other threads:[~2005-09-10 17:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-08 20:50 [PATCH 3/8] aacraid: handle AIF hotplug events Mark Haverkamp
2005-09-10 16:38 ` James Bottomley
2005-09-10 17:35   ` Stefan Richter
2005-09-10 17:50     ` James Bottomley [this message]
2005-09-10 21:16       ` scsi device refcounting in sbp2 (was Re: [PATCH 3/8] aacraid: handle AIF hotplug events) Stefan Richter
2005-09-10 22:49         ` James Bottomley
2005-09-11  0:24           ` scsi device refcounting in sbp2 Stefan Richter
2005-09-10 16:50 ` [PATCH 3/8] aacraid: handle AIF hotplug events Christoph Hellwig
2005-09-12 17:35   ` [PATCH 3/8] aacraid: handle AIF hotplug events (Updated) Mark Haverkamp
  -- strict thread matches above, loose matches on Subject: below --
2005-09-12 11:10 [PATCH 3/8] aacraid: handle AIF hotplug events Salyzyn, Mark
2005-09-13 10:03 ` Christoph Hellwig
2005-09-13 11:53 Salyzyn, Mark
2005-09-19 17:28 Salyzyn, Mark
2005-09-19 17:57 ` Mark Haverkamp
2005-09-19 18:27 Salyzyn, Mark
2005-09-19 19:28 Salyzyn, Mark

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=1126374650.4813.56.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=bcollins@debian.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark_salyzyn@adaptec.com \
    --cc=markh@osdl.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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