From: Michael Reed <mdr@sgi.com>
To: linux-scsi@vger.kernel.org
Cc: James.Smart@Emulex.Com,
James Bottomley <James.Bottomley@SteelEye.com>,
Christoph Hellwig <hch@lst.de>, Jeremy Higdon <jeremy@sgi.com>
Subject: [PATCH] Make scsi error recovery play nice with devices blocked by transport
Date: Fri, 16 Dec 2005 17:58:16 -0600 [thread overview]
Message-ID: <43A35498.6030903@sgi.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]
As no one has commented, I'm reposting this rfc as a patch. I've
been using it for all my testing during development of the LSI MPT Fusion
fc transport attribute patch and it has shown no ill effect.
--
Error recovery doesn't interact very well with fc targets which
have been blocked by the fc transport. Error recovery continues
to attempt to recover the target and ends up marking the fc target
offline. Once offline, if the target returns before the remote port is
removed, commands which could have been successfully reissued instead
are completed with an error status due to the offline status
of the target.
This patch makes a couple of hopefully minor tweaks to the error
recovery logic to work better with targets which have been blocked
by the transport.
First, if the target is blocked and error recovery gives up, don't
put the device offline. Either the transport will delete the target
thus disposing of any queued requests or it will unblock the target and
requests will be reissued.
Second, if a device is blocked, queue up commands being flushed from
the done queue for retry instead of completing them with an error.
Thanks,
Mike Reed
[-- Attachment #2: scsi_fc_recovery.patch --]
[-- Type: text/x-patch, Size: 2164 bytes --]
diff -ru linux-2.6.15-rc5-git6-patched/drivers/scsi/scsi_error.c linux-2.6.15-rc5-git6-patched-mdr/drivers/scsi/scsi_error.c
--- linux-2.6.15-rc5-git6-patched/drivers/scsi/scsi_error.c 2005-12-16 16:48:19.000000000 -0600
+++ linux-2.6.15-rc5-git6-patched-mdr/drivers/scsi/scsi_error.c 2005-12-16 17:42:07.000000000 -0600
@@ -1130,10 +1130,14 @@
struct scsi_cmnd *scmd, *next;
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- sdev_printk(KERN_INFO, scmd->device,
- "scsi: Device offlined - not"
- " ready after error recovery\n");
- scsi_device_set_state(scmd->device, SDEV_OFFLINE);
+ /* if blocked, transport will provide final device disposition */
+ if (!scsi_device_blocked(scmd->device)) {
+ sdev_printk(KERN_INFO, scmd->device,
+ "scsi: Device offlined - not"
+ " ready after error recovery\n");
+ scsi_device_set_state(scmd->device, SDEV_OFFLINE);
+ }
+
if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) {
/*
* FIXME: Handle lost cmds.
@@ -1460,9 +1464,10 @@
list_for_each_entry_safe(scmd, next, done_q, eh_entry) {
list_del_init(&scmd->eh_entry);
- if (scsi_device_online(scmd->device) &&
+ if (scsi_device_blocked(scmd->device) ||
+ (scsi_device_online(scmd->device) &&
!blk_noretry_request(scmd->request) &&
- (++scmd->retries < scmd->allowed)) {
+ (++scmd->retries < scmd->allowed))) {
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush"
" retry cmd: %p\n",
current->comm,
diff -ru linux-2.6.15-rc5-git6-patched/include/scsi/scsi_device.h linux-2.6.15-rc5-git6-patched-mdr/include/scsi/scsi_device.h
--- linux-2.6.15-rc5-git6-patched/include/scsi/scsi_device.h 2005-12-05 12:39:40.000000000 -0600
+++ linux-2.6.15-rc5-git6-patched-mdr/include/scsi/scsi_device.h 2005-12-16 17:42:07.000000000 -0600
@@ -275,6 +275,11 @@
int data_direction, void *buffer, unsigned bufflen,
struct scsi_sense_hdr *, int timeout, int retries);
+static inline int scsi_device_blocked(struct scsi_device *sdev)
+{
+ return sdev->sdev_state == SDEV_BLOCK;
+}
+
static inline unsigned int sdev_channel(struct scsi_device *sdev)
{
return sdev->channel;
next reply other threads:[~2005-12-16 23:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-16 23:58 Michael Reed [this message]
2005-12-28 16:04 ` [PATCH] Make scsi error recovery play nice with devices blocked by transport James Smart
2006-01-06 21:33 ` Michael Reed
2006-01-09 15:01 ` James Smart
2006-01-09 15:39 ` James Bottomley
2006-01-13 19:29 ` Michael Reed
2006-01-13 19:38 ` Christoph Hellwig
2006-01-13 19:50 ` Michael Reed
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=43A35498.6030903@sgi.com \
--to=mdr@sgi.com \
--cc=James.Bottomley@SteelEye.com \
--cc=James.Smart@Emulex.Com \
--cc=hch@lst.de \
--cc=jeremy@sgi.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;
as well as URLs for NNTP newsgroup(s).