All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takahiro Yasui <tyasui@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, mchristi@redhat.com, mbarrow@redhat.com
Subject: Re: [RFC][PATCH] limit state change to SDEV_BLOCK devices in	scsi_internal_device_unblock
Date: Mon, 27 Apr 2009 19:52:57 -0400	[thread overview]
Message-ID: <49F64559.5020802@redhat.com> (raw)
In-Reply-To: <1240862889.3387.37.camel@mulgrave.int.hansenpartnership.com>

James Bottomley wrote:
>> +	if (sdev->sdev_state != SDEV_BLOCK)
> 
> This isn't quite correct.  There are two blocked states in the model
> currently:  SDEV_BLOCK and SDEV_CREATED_BLOCK ... you'd need to check
> for both of them
> 
>> +		return 0;
> 
> Traditionally the return for an attempted invalid state transition is
> -EINVAL.
> 
> I suppose for lower down, if you check the state, now we know we go 
> 
> SDEV_CREATED_BLOCK -> SDEV_CREATED
> 
> or
> 
> SDEV_BLOCK -> SDEV_RUNNING
> 
> so there's no need for the dual scsi_device_set_state.

Thank you for the comments. If I understand your comments correctly, 
the state transition is better to be defined in scsi_device_set_state(),
and both transitions, "SDEV_CREATED_BLOCK -> SDEV_CREATED" and
"SDEV_BLOCK -> SDEV_RUNNING" need to be covered. I updated the patch
so that the transition of "SDEV_OFFLINE -> SDEV_RUNNING" is prohibited.

A note in this change is all transitions of "SDEV_OFFLINE -> SDEV_RUNNING"
is prohibited, and the following state change for devices in SDEV_OFFLINE
state fails.

  # echo running > /sys/block/sdX/device/state

Therefore, users need to delete the device once and then those devices
need to be scanned as follows.

  # echo yes > /sys/block/sdX/device/delete
  # echo "- - -" > /sys/class/scsi_host/hostX/scan

I appreciate your reviews on it.

Regards,
---
Takahiro Yasui
Hitachi Computer Products (America), Inc.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 drivers/scsi/scsi_lib.c |    1 -
 1 file changed, 1 deletion(-)

Index: linux-2.6.29/drivers/scsi/scsi_lib.c
===================================================================
--- linux-2.6.29.orig/drivers/scsi/scsi_lib.c
+++ linux-2.6.29/drivers/scsi/scsi_lib.c
@@ -2258,7 +2258,6 @@ scsi_device_set_state(struct scsi_device
 	case SDEV_RUNNING:
 		switch (oldstate) {
 		case SDEV_CREATED:
-		case SDEV_OFFLINE:
 		case SDEV_QUIESCE:
 		case SDEV_BLOCK:
 			break;




  reply	other threads:[~2009-04-27 23:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 17:09 [RFC][PATCH] limit state change to SDEV_BLOCK devices in scsi_internal_device_unblock Takahiro Yasui
2009-04-27 18:03 ` Matthew Wilcox
2009-04-27 19:43   ` Takahiro Yasui
2009-04-27 20:08 ` James Bottomley
2009-04-27 23:52   ` Takahiro Yasui [this message]
2009-04-28  2:31     ` Matthew Wilcox
2009-04-28  2:51       ` Takahiro Yasui
2009-04-28  3:27         ` Takahiro Yasui

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=49F64559.5020802@redhat.com \
    --to=tyasui@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mbarrow@redhat.com \
    --cc=mchristi@redhat.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.