From: James Bottomley <James.Bottomley@SteelEye.com>
To: Mike Anderson <andmike@us.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: Questions about scsi_target_reap and starget/sdev lifecyle
Date: Thu, 16 Jun 2005 08:57:40 -0500 [thread overview]
Message-ID: <1118930260.4998.6.camel@mulgrave> (raw)
In-Reply-To: <20050616073127.GA20051@us.ibm.com>
On Thu, 2005-06-16 at 00:31 -0700, Mike Anderson wrote:
> I have something similar that I was testing since you mentioned the
> problem the other day. Our build machine went down so I will need to wait
> until tomorrow to get access to my patches for a post, if you have already
> rolled a patch we can compare notes when I post.
>
> What I did in the patch sequence was:
> 1.) Recode the scsi_host state model to align with the device
> state model (i.e. added scsi_host_set_state function and
> associated changes).
> 2.) Made shost cancel matched the scsi device state model and set
> this at the top of scsi_remove_host. Previous cancel code was not
> doing anything as the list was normally empty do to
> scsi_forget_host being called first. Also there where possible
> race conditions that you previously mentioned about canceling
> commands in this method.
> 3.) Added choke point checks under the scan_mutex to determine if
> scanning is allowed (scsi_host_scan_allowed).
> 4.) Added a target state model to match the scsi device state
> model.
> 5.) I use the STGT_CANCEL and STGT_DEL states in scsi_forget_host
> to skip over entries in the list as I am no longer using the
> _safe version.
> This looks like a good starting point with limited testing. I also need to
> more states to the target state model as I only added a few that I needed
> for the delete code.
That sounds something like what I was thinking.
There is some subtlety to this: the call to forget host with existing
targets must:
a) put the host into a state where it won't accept any additions or
removal.
b) loop over targets and devices removing them from visibility and doing
final puts for them
c) finally remove the host from visibility, set the deleted state and do
the final put (which may not remove the actual structure until the last
referrer relinquishes its reference).
Also, since the target is a pure container, I don't think it needs to be
a party to the state model.
Anyway, post the code and we can refine it.
James
next prev parent reply other threads:[~2005-06-16 13:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-14 21:27 Questions about scsi_target_reap and starget/sdev lifecyle Alan Stern
2005-06-15 3:28 ` James Bottomley
2005-06-15 20:07 ` Alan Stern
2005-06-15 21:11 ` Alan Stern
2005-06-15 23:03 ` James Bottomley
2005-06-16 2:22 ` Alan Stern
2005-06-16 7:31 ` Mike Anderson
2005-06-16 13:57 ` James Bottomley [this message]
2005-06-17 2:01 ` Alan Stern
2005-06-18 20:14 ` Alan Stern
2005-06-20 15:52 ` Brian King
2005-06-20 16:35 ` Alan Stern
2005-06-20 17:31 ` Patrick Mansfield
2005-06-20 19:24 ` Alan Stern
2005-06-21 17:12 ` Mike Anderson
2005-06-21 17:43 ` Patrick Mansfield
2005-06-21 19:24 ` Mike Anderson
2005-06-21 20:04 ` Alan Stern
2005-06-21 20:10 ` Christoph Hellwig
2005-06-21 20:33 ` Alan Stern
2005-06-21 20:58 ` Mike Anderson
2005-06-21 21:22 ` Alan Stern
2005-06-22 13:44 ` Luben Tuikov
2005-06-22 13:36 ` Luben Tuikov
2005-06-22 15:12 ` Alan Stern
2005-06-22 15:46 ` Luben Tuikov
2005-06-22 16:16 ` Alan Stern
2005-06-22 16:53 ` Luben Tuikov
2005-06-21 21:08 ` Mike Anderson
2005-06-21 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=1118930260.4998.6.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=andmike@us.ibm.com \
--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