public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: James.Smart@Emulex.Com
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] Another fix for suspend i/o - validate dev state before transition
Date: Fri, 10 Dec 2004 22:48:42 -0600	[thread overview]
Message-ID: <1102740522.5181.8.camel@mulgrave> (raw)
In-Reply-To: <0B1E13B586976742A7599D71A6AC733C02F279@xbl3.ma.emulex.com>

On Wed, 2004-11-17 at 13:39 -0500, James.Smart@Emulex.Com wrote:
> The block/unblock patch reports stack dumps and illegal transitions when the driver continues to call block or unblock after the device has failed (moved into offline state due to i/o error, etc). The LLDD/transport is unaware of the sdev transition, so it doesn't know better.

> This patch has the internal device block/unblock routines validate the state transition before invoking it.

Well, my basic problem with this is that the idea of the state model is
to consolidate the allowed transitions in a single place.  Having the
calling routines second guess the transitions rather defeats that
purpose.

If the only problem with the current scheme is the somewhat scary
verbosity then we can shut it up by making the message part of the
logging infrastructure.

How about the attached (ERROR_RECOVERY is the closest log function I can
find which seems to fit the bill).

James

===== scsi_lib.c 1.140 vs edited =====
--- 1.140/drivers/scsi/scsi_lib.c	2004-11-28 06:12:22 -06:00
+++ edited/scsi_lib.c	2004-12-10 22:44:53 -06:00
@@ -1710,11 +1710,12 @@
 	return 0;
 
  illegal:
-	dev_printk(KERN_ERR, &sdev->sdev_gendev,
-		   "Illegal state transition %s->%s\n",
-		   scsi_device_state_name(oldstate),
-		   scsi_device_state_name(state));
-	WARN_ON(1);
+	SCSI_LOG_ERROR_RECOVERY(1, 
+				dev_printk(KERN_ERR, &sdev->sdev_gendev,
+					   "Illegal state transition %s->%s\n",
+					   scsi_device_state_name(oldstate),
+					   scsi_device_state_name(state))
+				);
 	return -EINVAL;
 }
 EXPORT_SYMBOL(scsi_device_set_state);



  reply	other threads:[~2004-12-11  4:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 18:39 [PATCH] Another fix for suspend i/o - validate dev state before transition James.Smart
2004-12-11  4:48 ` James Bottomley [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-30 21:17 James.Smart

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=1102740522.5181.8.camel@mulgrave \
    --to=james.bottomley@steeleye.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