From: Mike Christie <michaelc@cs.wisc.edu>
To: scameron@beardog.cce.hp.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: Are these comments in scsi_host.h still true?
Date: Tue, 06 Mar 2012 17:07:16 -0600 [thread overview]
Message-ID: <4F5698A4.5090306@cs.wisc.edu> (raw)
In-Reply-To: <20120305231858.GB22578@beardog.cce.hp.com>
On 03/05/2012 05:18 PM, scameron@beardog.cce.hp.com wrote:
>
> Is this comment from include/scsi/scsi_host.h still true?
>
> /*
> * This is an error handling strategy routine. You don't need to
> * define one of these if you don't want to - there is a default
> * routine that is present that should work in most cases. For those
> * driver authors that have the inclination and ability to write their
> * own strategy routine, this is where it is specified. Note - the
> ----> * strategy routine is *ALWAYS* run in the context of the kernel eh
> ----> * thread. Thus you are guaranteed to *NOT* be in an interrupt
> ----> * handler when you execute this, and you are also guaranteed to
> ----> * *NOT* have any other commands being queued while you are in the
> * strategy routine. When you return from this function, operations
> * return to normal.
> *
> * See scsi_error.c scsi_unjam_host for additional comments about
> * what this function should and should not be attempting to do.
> *
> * Status: REQUIRED (at least one of them)
> */
>
> Also what about this, about scsi_unjam_host() from scsi_error.c?
>
> * Notes:
> * When we come in here, we *know* that all commands on the bus have
> * either completed, failed or timed out. we also know that no further
> * commands are being sent to the host, so things are relatively quiet
> * and we have freedom to fiddle with things as we wish.
>
> I'm not seeing what code makes sure those are true.
>
For the strategy handler/unjam case this is true. See scsi_times_out ->
scsi_eh_scmd_add. That will set the host state so not new commands are
stated and will begin the process of making sure that commands are
either timedout or completed. See the host_busy and host_failed checks
in scsi_error.c. Those will prevent the scsi eh unjam stuff from
starting when commands not completed or timedout (host_busy is
incremented in scsi_request_fn when commands are queued).
However, some of your eh callbacks can be called while IO is still
running. If you did sg_reset /dev/sda for example, that calls
scsi_nonblockable_ioctl and that prevents new IOs from coming in
(scsi_reset_provider sets the tmf_in_progress flag which is checked in
scsi_host_queue_ready's scsi_host_in_recovery call). But in this path we
do not wait for all IO to timeout or complete like we do in the
unjam/strategy handler cases.
prev parent reply other threads:[~2012-03-06 23:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 23:18 Are these comments in scsi_host.h still true? scameron
2012-03-06 23:07 ` Mike Christie [this message]
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=4F5698A4.5090306@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=linux-scsi@vger.kernel.org \
--cc=scameron@beardog.cce.hp.com \
/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.