|
@@ -2932,6 +2932,8 @@ EXPORT_SYMBOL(scsi_target_resume);
|
|
|
/**
|
|
|
* scsi_internal_device_block - internal function to put a device temporarily into the SDEV_BLOCK state
|
|
|
* @sdev: device to block
|
|
|
+ * @wait: Whether or not to wait until ongoing .queuecommand() /
|
|
|
+ * .queue_rq() calls have finished.
|
|
|
*
|
|
|
* Block request made by scsi lld's to temporarily stop all
|
|
|
* scsi commands on the specified device. May sleep.
|
|
@@ -2949,7 +2951,7 @@ EXPORT_SYMBOL(scsi_target_resume);
|
|
|
* remove the rport mutex lock and unlock calls from srp_queuecommand().
|
|
|
*/
|
|
|
int
|
|
|
-scsi_internal_device_block(struct scsi_device *sdev)
|
|
|
+scsi_internal_device_block(struct scsi_device *sdev, bool wait)
|
|
|
{
|
|
|
struct request_queue *q = sdev->request_queue;
|
|
|
unsigned long flags;
|
|
@@ -2969,12 +2971,16 @@ scsi_internal_device_block(struct scsi_device *sdev)
|
|
|
* request queue.
|
|
|
*/
|
|
|
if (q->mq_ops) {
|
|
|
- blk_mq_quiesce_queue(q);
|
|
|
+ if (wait)
|
|
|
+ blk_mq_quiesce_queue(q);
|
|
|
+ else
|
|
|
+ blk_mq_stop_hw_queues(q);
|
|
|
} else {
|
|
|
spin_lock_irqsave(q->queue_lock, flags);
|
|
|
blk_stop_queue(q);
|
|
|
spin_unlock_irqrestore(q->queue_lock, flags);
|
|
|
- scsi_wait_for_queuecommand(sdev);
|
|
|
+ if (wait)
|
|
|
+ scsi_wait_for_queuecommand(sdev);
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@@ -3036,7 +3042,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_unblock);
|
|
|
static void
|
|
|
device_block(struct scsi_device *sdev, void *data)
|
|
|
{
|
|
|
- scsi_internal_device_block(sdev);
|
|
|
+ scsi_internal_device_block(sdev, true);
|
|
|
}
|
|
|
|
|
|
static int
|