diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-06-21 10:55:47 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-21 12:01:15 -0600 |
commit | 852ec80983d682dc08a0573d37eeaa9814c4f6b1 (patch) | |
tree | a28ce236f89bd4c8e05a16e5869f3702ba914ea4 /block | |
parent | 34bd9c1c4f62e936d8865e6442f332cd85bdfc95 (diff) | |
download | linux-852ec80983d682dc08a0573d37eeaa9814c4f6b1.tar.gz linux-852ec80983d682dc08a0573d37eeaa9814c4f6b1.tar.bz2 linux-852ec80983d682dc08a0573d37eeaa9814c4f6b1.zip |
blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler
Since blk_mq_quiesce_queue_nowait() can be called from interrupt
context, make this safe. Since this function is not in the hot
path, uninline it.
Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 1c4f1f4978c6..2caac30e128a 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q) } EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); +/* + * FIXME: replace the scsi_internal_device_*block_nowait() calls in the + * mpt3sas driver such that this function can be removed. + */ +void blk_mq_quiesce_queue_nowait(struct request_queue *q) +{ + unsigned long flags; + + spin_lock_irqsave(q->queue_lock, flags); + queue_flag_set(QUEUE_FLAG_QUIESCED, q); + spin_unlock_irqrestore(q->queue_lock, flags); +} +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait); + /** * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished * @q: request queue. @@ -190,9 +204,11 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue); */ void blk_mq_unquiesce_queue(struct request_queue *q) { - spin_lock_irq(q->queue_lock); + unsigned long flags; + + spin_lock_irqsave(q->queue_lock, flags); queue_flag_clear(QUEUE_FLAG_QUIESCED, q); - spin_unlock_irq(q->queue_lock); + spin_unlock_irqrestore(q->queue_lock, flags); /* dispatch requests which are inserted during quiescing */ blk_mq_run_hw_queues(q, true); |