From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [RFC] [PATCH] scsi_eh_abort_cmds on failed devices
Date: Tue, 16 Dec 2008 11:43:44 +0100 [thread overview]
Message-ID: <49478660.2050701@suse.de> (raw)
Hi all,
I keep on stumbling across this in scsi_eh_abort_cmds():
rtn = scsi_try_to_abort_cmd(scmd);
if (rtn == SUCCESS) {
scmd->eh_eflags &= ~SCSI_EH_CANCEL_CMD;
if (!scsi_device_online(scmd->device) ||
!scsi_eh_tur(scmd)) {
scsi_eh_finish_cmd(scmd, done_q);
}
Now scsi_device_online() translates to:
static inline int scsi_device_online(struct scsi_device *sdev)
{
return sdev->sdev_state != SDEV_OFFLINE;
}
Assume that the device has already vanished at this point
(ie sdev_state would be SDEV_DEL) we would be happily sending
a TUR command to a deleted device, right?
And as scsi_eh_tur command is using the ->queuecommand callback
directly, any normal checks for the sdev_state do not apply here.
Isn't something like this in order here?
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f394649..6e2305d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -778,6 +778,9 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigne
d char *cmnd,
struct scsi_eh_save ses;
int rtn;
+ if (sdev->sdev_state == SDEV_CANCEL || sdev->sdev_state == SDEV_DEL)
+ return FAILED;
+
scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
shost->eh_action = &done;
Thanks for any feedback.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2008-12-16 10:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=49478660.2050701@suse.de \
--to=hare@suse.de \
--cc=James.Bottomley@HansenPartnership.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 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.