From: Mike Anderson <andmike@us.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: Questions about scsi_target_reap and starget/sdev lifecyle
Date: Tue, 21 Jun 2005 14:08:17 -0700 [thread overview]
Message-ID: <20050621210817.GC30526@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0506211526360.634-100000@iolanthe.rowland.org>
Alan Stern [stern@rowland.harvard.edu] wrote:
> > Moving scsi_forget_host to after scsi_host_cancel will cause the sd cache
> > flush routines to fail.
>
> This objection runs up against an issue we discussed some time ago.
> Should the intended meaning of scsi_remove_host be simply that the kernel
> needs to stop using the HBA reasonably soon? In that case you are right.
> Or should the intended meaning be that the HBA is actually gone
> (hot-unplugged) and all further attempts to use it will fail? In that
> case it doesn't matter. The best ways to resolve this issue may be to
> have a separate scsi_host_gone routine or to add an extra argument to
> scsi_remove_host.
>
I believe this was discussed in the thread below or possible another (we
have had this conversation a number of times), and the action then was not
to create another interface.
http://marc.theaimsgroup.com/?t=108701426000002&r=1&w=2
> I rather agree in principle that the cancel functionality isn't really
> needed. Removing it will require some tricky changes to the LLDDs,
> however. And the changes will all have to be made at once. If some LLDDs
> are changed and others aren't, then (depending on whether scsi_host_cancel
> has been removed) either the changed ones will oops as they try to cancel
> an already-cancelled command or the unchanged ones will oops as
> uncancelled commands time out. I've seen both kinds of errors in working
> with usb-storage.
We really should have scsi_times_out check the state of the host and
possible the device to stop calling into the host when removes are in
progress.
>
> > The bit is set to SHOST_REMOVE then scsi_host_cancel is called which will
> > set the bit SHOST_CANCEL. Later on scan is stopped only if state is
> > SHOST_REMOVE. Is that what you wanted?
>
> Remember, at the moment the state is a bit-vector. It can have both
> SHOST_CANCEL and SHOST_REMOVE set at the same time. That is what I
> wanted. Changing to a host state model will of course require you to do
> things differently.
Yes, I guess I should know that :-(. I had my head in the new host state
model. Yes changing to the host state model did require some different
checks, but the concept is the same.
>
> > > int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
> > > @@ -1347,11 +1363,14 @@
> > > return -EINVAL;
> > >
> > > down(&shost->scan_mutex);
> > > + if (test_bit(SHOST_REMOVE, &shost->shost_state))
> > > + goto out;
> > > if (channel == SCAN_WILD_CARD)
> > > for (channel = 0; channel <= shost->max_channel; channel++)
> > > scsi_scan_channel(shost, channel, id, lun, rescan);
> > > else
> > > scsi_scan_channel(shost, channel, id, lun, rescan);
> > > +out:
> > > up(&shost->scan_mutex);
> > >
> > > return 0;
> >
> > It might be better to have a wrapper function so if we change the cases
> > where we would allow scanning we can change just one place. Also we might
> > cover more states if we reverse the logic on the check and look for the
> > case we allow scanning (see previous comment about cancel). This is what I
> > did in my previous patch.
>
> That's okay with me. So long as all the scanning pathways are covered and
> all scanning is stopped before scsi_forget_host runs, you can feel free to
> improve the implementation details.
>
I already did this in the previous patch series I posted, but received not
comments so I guess there is no need to wrap it.
>
> I didn't do it that way because it can't be made to work correctly with
> the current code -- there's no way to know whether a target has already
> been removed. Adding a target state model would make your approach
> feasible, but James has said that targets don't merit a state model.
>
> Driver model klists also have their disadvantages. If you delete a node
> from a klist asynchronously then you cannot re-use it; it must be allowed
> to deallocate itself when the refcount goes to 0. And it's not possible
> to remove nodes from a klist synchronously while traversing the klist.
Is this still true for klists. I thought the locking updates and the
addition of a klist_iter was to fix this issue though I have not spent
much time looking through the code since the changes.
-andmike
--
Michael Anderson
andmike@us.ibm.com
next prev parent reply other threads:[~2005-06-21 21:08 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
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 [this message]
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=20050621210817.GC30526@us.ibm.com \
--to=andmike@us.ibm.com \
--cc=James.Bottomley@SteelEye.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.