aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/scsi_lib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index bb218c8b6e98..27dbf2e8e34a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2441,20 +2441,18 @@ int
2441scsi_internal_device_unblock(struct scsi_device *sdev) 2441scsi_internal_device_unblock(struct scsi_device *sdev)
2442{ 2442{
2443 struct request_queue *q = sdev->request_queue; 2443 struct request_queue *q = sdev->request_queue;
2444 int err;
2445 unsigned long flags; 2444 unsigned long flags;
2446 2445
2447 /* 2446 /*
2448 * Try to transition the scsi device to SDEV_RUNNING 2447 * Try to transition the scsi device to SDEV_RUNNING
2449 * and goose the device queue if successful. 2448 * and goose the device queue if successful.
2450 */ 2449 */
2451 err = scsi_device_set_state(sdev, SDEV_RUNNING); 2450 if (sdev->sdev_state == SDEV_BLOCK)
2452 if (err) { 2451 sdev->sdev_state = SDEV_RUNNING;
2453 err = scsi_device_set_state(sdev, SDEV_CREATED); 2452 else if (sdev->sdev_state == SDEV_CREATED_BLOCK)
2454 2453 sdev->sdev_state = SDEV_CREATED;
2455 if (err) 2454 else
2456 return err; 2455 return -EINVAL;
2457 }
2458 2456
2459 spin_lock_irqsave(q->queue_lock, flags); 2457 spin_lock_irqsave(q->queue_lock, flags);
2460 blk_start_queue(q); 2458 blk_start_queue(q);