Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [patch 0/6] marginalize HCIL a bit
Date: Sun, 23 Oct 2005 10:29:32 -0500	[thread overview]
Message-ID: <1130081372.3437.33.camel@mulgrave> (raw)
In-Reply-To: <20051023013618.GA18201@havoc.gtf.org>

On Sat, 2005-10-22 at 21:36 -0400, Jeff Garzik wrote:
> This patch series makes a tiny bit of progress on the marginalize-SPI
> todo list.
> 
> Patches:
> 1) s/scsi_scan_target/spi_scan_target/
> 2) remove unused scsi_scan_single_target()
> 3) add scsi_scan_target()
> 4) kill all uses of spi_scan_target()
> 5) kill spi_scan_target(), __spi_scan_target()
> 6) misc cleanups

There's an unaddressed lifetime problem in all of this:  Originally the
target object exists solely internally and has its lifetime managed by
the mid-layer (it actually exists only as long as there are LUNs on it).

In your code cleanups, you keep the scsi_target_reap() function (which
is what checks the children and tries to destroy the device if it
doesn't find any) private (well, unexported).  So, on return from your
new scsi_scan_target(), the target pointer might be invalid (already
freed) if you didn't take a reference to starget->dev.  That's counter
to the way lifetime management of objects usually works.

I think the choices are

1. Make the target an explicit object (like it's peers scsi_device and
scsi_host), so the layer creating it is responsible for managing it.
This will get tricky, particularly as we'd need at least lun removal
notifications so the creating layer can decide on destruction.
2. Move scsi_scan_target() into scsi_priv.h to imply only transport
classes should be using it (where there'll be much more scrutiny on
getting the unusual rules right).

James



  parent reply	other threads:[~2005-10-23 15:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-23  1:36 [patch 0/6] marginalize HCIL a bit Jeff Garzik
2005-10-23  1:37 ` [patch 1/6] SCSI HCIL: s/scsi_scan_target/spi_scan_target/ Jeff Garzik
2005-10-23  1:38 ` [patch 2/6] SCSI HCIL: remove unused scsi_scan_single_target() Jeff Garzik
2005-10-23  1:53   ` Matthew Wilcox
2005-10-23  1:38 ` [patch 3/6] SCSI HCIL: add scsi_scan_target() Jeff Garzik
2005-10-23  1:50   ` Matthew Wilcox
2005-10-23  1:54     ` Jeff Garzik
2005-10-23  2:00       ` Matthew Wilcox
2005-10-23  2:42         ` Jeff Garzik
2005-10-23  2:26     ` Randy.Dunlap
2005-10-23  1:40 ` [patch 4/6] SCSI HCIL: kill all uses of spi_scan_target() Jeff Garzik
2005-10-23  1:56   ` Matthew Wilcox
2005-10-23  1:40 ` [patch 5/6] SCSI HCIL: kill spi_scan_target(), __spi_scan_target() Jeff Garzik
2005-10-23  1:41 ` [patch 6/6] SCSI HCIL: misc cleanups Jeff Garzik
2005-10-23  2:03   ` Matthew Wilcox
2005-10-23  1:45 ` [patch 0/6] marginalize HCIL a bit Jeff Garzik
2005-10-23 15:29 ` James Bottomley [this message]
2005-10-24 15:49   ` Luben Tuikov
2005-10-24 16:50     ` James Bottomley
2005-10-24 17:18       ` Luben Tuikov
2005-10-24 20:28         ` James Bottomley
2005-10-24 20:41           ` Luben Tuikov
2005-10-24 21:12             ` James Bottomley
2005-10-24 22:38               ` Luben Tuikov

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=1130081372.3437.33.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-scsi@vger.kernel.org \
    /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