diff options
author | Bart Van Assche <bvanassche@acm.org> | 2014-02-20 17:20:56 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:25 -0400 |
commit | 613be1f626e602c6744101a003e8fc5c180e1af9 (patch) | |
tree | 4c78a6ed1be7b817fdb7a233dd1d346e786f2f31 /drivers/scsi/scsi_lib.c | |
parent | 0479633686d370303e3430256ace4bd5f7f138dc (diff) |
[SCSI] remove a useless get/put_device pair in scsi_request_fn
SCSI devices may only be removed by calling scsi_remove_device().
That function must invoke blk_cleanup_queue() before the final put
of sdev->sdev_gendev. Since blk_cleanup_queue() waits for the
block queue to drain and then tears it down, scsi_request_fn cannot
be active anymore after blk_cleanup_queue() has returned and hence
the get_device()/put_device() pair in scsi_request_fn is unnecessary.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 007e979fa437..f8a8765a7979 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1565,16 +1565,14 @@ static void scsi_softirq_done(struct request *rq) | |||
1565 | * Lock status: IO request lock assumed to be held when called. | 1565 | * Lock status: IO request lock assumed to be held when called. |
1566 | */ | 1566 | */ |
1567 | static void scsi_request_fn(struct request_queue *q) | 1567 | static void scsi_request_fn(struct request_queue *q) |
1568 | __releases(q->queue_lock) | ||
1569 | __acquires(q->queue_lock) | ||
1568 | { | 1570 | { |
1569 | struct scsi_device *sdev = q->queuedata; | 1571 | struct scsi_device *sdev = q->queuedata; |
1570 | struct Scsi_Host *shost; | 1572 | struct Scsi_Host *shost; |
1571 | struct scsi_cmnd *cmd; | 1573 | struct scsi_cmnd *cmd; |
1572 | struct request *req; | 1574 | struct request *req; |
1573 | 1575 | ||
1574 | if(!get_device(&sdev->sdev_gendev)) | ||
1575 | /* We must be tearing the block queue down already */ | ||
1576 | return; | ||
1577 | |||
1578 | /* | 1576 | /* |
1579 | * To start with, we keep looping until the queue is empty, or until | 1577 | * To start with, we keep looping until the queue is empty, or until |
1580 | * the host is no longer able to accept any more requests. | 1578 | * the host is no longer able to accept any more requests. |
@@ -1663,7 +1661,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1663 | goto out_delay; | 1661 | goto out_delay; |
1664 | } | 1662 | } |
1665 | 1663 | ||
1666 | goto out; | 1664 | return; |
1667 | 1665 | ||
1668 | not_ready: | 1666 | not_ready: |
1669 | spin_unlock_irq(shost->host_lock); | 1667 | spin_unlock_irq(shost->host_lock); |
@@ -1682,12 +1680,6 @@ static void scsi_request_fn(struct request_queue *q) | |||
1682 | out_delay: | 1680 | out_delay: |
1683 | if (sdev->device_busy == 0) | 1681 | if (sdev->device_busy == 0) |
1684 | blk_delay_queue(q, SCSI_QUEUE_DELAY); | 1682 | blk_delay_queue(q, SCSI_QUEUE_DELAY); |
1685 | out: | ||
1686 | /* must be careful here...if we trigger the ->remove() function | ||
1687 | * we cannot be holding the q lock */ | ||
1688 | spin_unlock_irq(q->queue_lock); | ||
1689 | put_device(&sdev->sdev_gendev); | ||
1690 | spin_lock_irq(q->queue_lock); | ||
1691 | } | 1683 | } |
1692 | 1684 | ||
1693 | u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) | 1685 | u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) |