public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 4/5] SCSI: fix bad method call in scsi_target_destroy
Date: Fri, 19 Feb 2010 10:29:43 -0600	[thread overview]
Message-ID: <1266596983.2822.40.camel@mulgrave.site> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1002121211190.1307-100000@iolanthe.rowland.org>

On Fri, 2010-02-12 at 12:14 -0500, Alan Stern wrote:
> This patch (as1336) fixes a bug in scsi_target_destroy().  It calls
> the host template's target_destroy method even if the target_alloc
> method failed.  (Also, the target_destroy method is called inside the
> scope of the host lock, which is unnecessary and probably a mistake.)

OK, so this isn't a mistake.  The act of create/destroy on the target
and removing it from the lists has to be atomic for devices which use
fixed slots (most SPI cards).  If the target is still in the list after
destroy, it could end up getting spuriously reused.  Conversely, if you
remove it from the list and then destroy, we could end up getting target
alloc for a new target called *before* the target_destroy of the old
one.

> A new flag is added to struct scsi_target to remember whether or not
> the target_alloc has succeeded.  There also are a couple of minor
> whitespace formatting improvements.

I don't really see the need for this.  None of the users assumes the
target was created ... if they do allocations, they all check before
unwinding.  If there is a case for needing this, it should be part of
the target state flags.

James



  reply	other threads:[~2010-02-19 16:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 17:14 [PATCH 4/5] SCSI: fix bad method call in scsi_target_destroy Alan Stern
2010-02-19 16:29 ` James Bottomley [this message]
2010-02-19 19:53   ` Alan Stern
2010-03-12 18:00     ` James Bottomley
2010-03-12 21:37       ` Alan Stern

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=1266596983.2822.40.camel@mulgrave.site \
    --to=james.bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.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