From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Smart <James.Smart@Emulex.Com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: fc_remote_port_delete and returning SCSI commands from LLD
Date: Fri, 23 Oct 2009 09:58:40 +0200 [thread overview]
Message-ID: <20091023075839.GC5930@schmichrtp.de.ibm.com> (raw)
In-Reply-To: <4ADF37D5.5090507@emulex.com>
On Wed, Oct 21, 2009 at 12:33:25PM -0400, James Smart wrote:
> Here's what I remember about this from the past:
>
> - This was originally added when dealing with older kernels that didn't
> have the eh patch that bounced the timeout handler when the rport was
> blocked (see fc_timed_out).
>
> The eh patch avoided entering the eh thread upon i/o timeouts if the
> rport was blocked.
>
>
> - As mentioned in my prior email - there's a window where things can be
> entered before the target blocked state protects you. What if you are in
> the eh_handler when it occurs ? Unfortunately, the eh thread is very
> black and white on abort/reset/io status - its either success or not. It
> doesn't validate the "not" cases, never looks at retry conditions, and
> just assumes hard failure - which was taking everyone down bad paths.
> This is a rats nest to resolve right, and I think I mentioned it on the
> list a long time ago with Christoph. Thus the stall was added to plug the
> hole.
I could imagine the case where something triggers the SCSI eh thread
(e.g. a command timeout), but as soon as the eh thread starts the
recovery, something else prevents access to the remote port. Returning
DID_IMM_RETRY from fc_remote_port_chkready or the LLD does not help,
scsi_eh_completed_normally simply maps this error code to FAILED.
Holding off the SCSI eh thread until the rport leaves the BLOCKED
state will guarantee that we can either reach the rport or the SCSI
devices are being removed anyway.
It looks to me like this is required to prevent offline SCSI devices
in this case. Should this code be in a FC transport helper function
rather than being duplicated in each FC LLD?
Christof
> Christof Schmitt wrote:
>> On Tue, Oct 20, 2009 at 04:40:27PM +0200, Christof Schmitt wrote:
>>> If the remote_port status is not BLOCKED, this will trigger the SCSI
>>> midlayer error handling which cannot do much during the interruption
>>> to the hardware and will mark the SCSI devices 'offline'. In order to
>>> prevent this, the rule would be: First call fc_remote_port_delete to
>>> set the remote port (or in the case of an HBA interruption all remote
>>> ports) to BLOCKED, and only after this step call scsi_done to pass the
>>> SCSI commands back to the upper layers.
>>
>> I just stumbled across a loop that blocks the SCSI error handling
>> thread:
>>
>> spin_lock_irqsave(shost->host_lock, flags);
>> while (rport->port_state == FC_PORTSTATE_BLOCKED) {
>> spin_unlock_irqrestore(shost->host_lock, flags);
>> msleep(1000);
>> spin_lock_irqsave(shost->host_lock, flags);
>> }
>> spin_unlock_irqrestore(shost->host_lock, flags);
>>
>> This seems to be popular among FC drivers. Is this the preferred way
>> to synchronize the FC transport class state changes with the SCSI
>> midlayer error recovery?
next prev parent reply other threads:[~2009-10-23 7:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 14:40 fc_remote_port_delete and returning SCSI commands from LLD Christof Schmitt
2009-10-21 15:24 ` Christof Schmitt
2009-10-21 16:33 ` James Smart
2009-10-23 7:58 ` Christof Schmitt [this message]
2009-10-23 14:50 ` James Smart
2009-10-27 16:59 ` Christof Schmitt
2009-10-27 19:44 ` James Smart
2009-10-21 16:24 ` James Smart
2009-10-23 7:47 ` Christof Schmitt
2009-10-23 14:47 ` James Smart
2009-10-27 21:57 ` Mike Christie
2009-10-21 18:11 ` Mike Christie
2009-10-23 7:13 ` Christof Schmitt
2009-10-27 21:53 ` Mike Christie
2009-10-28 14:27 ` Christof Schmitt
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=20091023075839.GC5930@schmichrtp.de.ibm.com \
--to=christof.schmitt@de.ibm.com \
--cc=James.Smart@Emulex.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