aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-10 13:53:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-10 13:53:26 -0400
commitef5bef357cdf49f3a386c7102dbf3be5f7e5c913 (patch)
tree48d9dc86768e3e146267ea21d0c898f9008275a1 /drivers/scsi/scsi_lib.c
parente26feff647ef34423b048b940540a0059001ddb0 (diff)
parent41bfcf90101601f9507240ff0435c1b73d28a132 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (37 commits) [SCSI] zfcp: fix double dbf id usage [SCSI] zfcp: wait on SCSI work to be finished before proceeding with init dev [SCSI] zfcp: fix erp list usage without using locks [SCSI] zfcp: prevent fc_remote_port_delete calls for unregistered rport [SCSI] zfcp: fix deadlock caused by shared work queue tasks [SCSI] zfcp: put threshold data in hba trace [SCSI] zfcp: Simplify zfcp data structures [SCSI] zfcp: Simplify get_adapter_by_busid [SCSI] zfcp: remove all typedefs and replace them with standards [SCSI] zfcp: attach and release SAN nameserver port on demand [SCSI] zfcp: remove unused references, declarations and flags [SCSI] zfcp: Update message with input from review [SCSI] zfcp: add queue_full sysfs attribute [SCSI] scsi_dh: suppress comparison warning [SCSI] scsi_dh: add Dell product information into rdac device handler [SCSI] qla2xxx: remove the unused SCSI_QLOGIC_FC_FIRMWARE option [SCSI] qla2xxx: fix printk format warnings [SCSI] qla2xxx: Update version number to 8.02.01-k8. [SCSI] qla2xxx: Ignore payload reserved-bits during RSCN processing. [SCSI] qla2xxx: Additional residual-count corrections during UNDERRUN handling. ...
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e7686500e9dd..98ee55ced592 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1250,6 +1250,7 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
1250 break; 1250 break;
1251 case SDEV_QUIESCE: 1251 case SDEV_QUIESCE:
1252 case SDEV_BLOCK: 1252 case SDEV_BLOCK:
1253 case SDEV_CREATED_BLOCK:
1253 /* 1254 /*
1254 * If the devices is blocked we defer normal commands. 1255 * If the devices is blocked we defer normal commands.
1255 */ 1256 */
@@ -2073,10 +2074,13 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2073 2074
2074 switch (state) { 2075 switch (state) {
2075 case SDEV_CREATED: 2076 case SDEV_CREATED:
2076 /* There are no legal states that come back to 2077 switch (oldstate) {
2077 * created. This is the manually initialised start 2078 case SDEV_CREATED_BLOCK:
2078 * state */ 2079 break;
2079 goto illegal; 2080 default:
2081 goto illegal;
2082 }
2083 break;
2080 2084
2081 case SDEV_RUNNING: 2085 case SDEV_RUNNING:
2082 switch (oldstate) { 2086 switch (oldstate) {
@@ -2114,8 +2118,17 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2114 2118
2115 case SDEV_BLOCK: 2119 case SDEV_BLOCK:
2116 switch (oldstate) { 2120 switch (oldstate) {
2117 case SDEV_CREATED:
2118 case SDEV_RUNNING: 2121 case SDEV_RUNNING:
2122 case SDEV_CREATED_BLOCK:
2123 break;
2124 default:
2125 goto illegal;
2126 }
2127 break;
2128
2129 case SDEV_CREATED_BLOCK:
2130 switch (oldstate) {
2131 case SDEV_CREATED:
2119 break; 2132 break;
2120 default: 2133 default:
2121 goto illegal; 2134 goto illegal;
@@ -2403,8 +2416,12 @@ scsi_internal_device_block(struct scsi_device *sdev)
2403 int err = 0; 2416 int err = 0;
2404 2417
2405 err = scsi_device_set_state(sdev, SDEV_BLOCK); 2418 err = scsi_device_set_state(sdev, SDEV_BLOCK);
2406 if (err) 2419 if (err) {
2407 return err; 2420 err = scsi_device_set_state(sdev, SDEV_CREATED_BLOCK);
2421
2422 if (err)
2423 return err;
2424 }
2408 2425
2409 /* 2426 /*
2410 * The device has transitioned to SDEV_BLOCK. Stop the 2427 * The device has transitioned to SDEV_BLOCK. Stop the
@@ -2447,8 +2464,12 @@ scsi_internal_device_unblock(struct scsi_device *sdev)
2447 * and goose the device queue if successful. 2464 * and goose the device queue if successful.
2448 */ 2465 */
2449 err = scsi_device_set_state(sdev, SDEV_RUNNING); 2466 err = scsi_device_set_state(sdev, SDEV_RUNNING);
2450 if (err) 2467 if (err) {
2451 return err; 2468 err = scsi_device_set_state(sdev, SDEV_CREATED);
2469
2470 if (err)
2471 return err;
2472 }
2452 2473
2453 spin_lock_irqsave(q->queue_lock, flags); 2474 spin_lock_irqsave(q->queue_lock, flags);
2454 blk_start_queue(q); 2475 blk_start_queue(q);