Commit 852ec809 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

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 f4560ffe ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
Signed-off-by: default avatarBart 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: default avatarJens Axboe <axboe@kernel.dk>
parent 34bd9c1c
...@@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q) ...@@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
} }
EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); 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 * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
* @q: request queue. * @q: request queue.
...@@ -190,9 +204,11 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue); ...@@ -190,9 +204,11 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
*/ */
void blk_mq_unquiesce_queue(struct request_queue *q) 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); 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 */ /* dispatch requests which are inserted during quiescing */
blk_mq_run_hw_queues(q, true); blk_mq_run_hw_queues(q, true);
......
...@@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set); ...@@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
int blk_mq_map_queues(struct blk_mq_tag_set *set); int blk_mq_map_queues(struct blk_mq_tag_set *set);
void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
/* void blk_mq_quiesce_queue_nowait(struct request_queue *q);
* FIXME: this helper is just for working around mpt3sas.
*/
static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
{
spin_lock_irq(q->queue_lock);
queue_flag_set(QUEUE_FLAG_QUIESCED, q);
spin_unlock_irq(q->queue_lock);
}
/* /*
* Driver command data is immediately after the request. So subtract request * Driver command data is immediately after the request. So subtract request
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment