Skip to content

Commit 9c3d53f

Browse files
Ming Leigregkh
Ming Lei
authored andcommitted
blk-mq: add non_owner variant of start_freeze/unfreeze queue APIs
[ Upstream commit 8acdd0e ] Add non_owner variant of start_freeze/unfreeze queue APIs, so that the caller knows that what they are doing, and we can skip lockdep support for non_owner variant in per-call level. Prepare for supporting lockdep for freezing/unfreezing queue. Reviewed-by: Christoph Hellwig <[email protected]> Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Stable-dep-of: 3802f73 ("block: fix uaf for flush rq while iterating tags") Signed-off-by: Sasha Levin <[email protected]>
1 parent 4eaa19c commit 9c3d53f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

block/blk-mq.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,26 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
196196
}
197197
EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
198198

199+
/*
200+
* non_owner variant of blk_freeze_queue_start
201+
*
202+
* Unlike blk_freeze_queue_start, the queue doesn't need to be unfrozen
203+
* by the same task. This is fragile and should not be used if at all
204+
* possible.
205+
*/
206+
void blk_freeze_queue_start_non_owner(struct request_queue *q)
207+
{
208+
blk_freeze_queue_start(q);
209+
}
210+
EXPORT_SYMBOL_GPL(blk_freeze_queue_start_non_owner);
211+
212+
/* non_owner variant of blk_mq_unfreeze_queue */
213+
void blk_mq_unfreeze_queue_non_owner(struct request_queue *q)
214+
{
215+
__blk_mq_unfreeze_queue(q, false);
216+
}
217+
EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue_non_owner);
218+
199219
/*
200220
* FIXME: replace the scsi_internal_device_*block_nowait() calls in the
201221
* mpt3sas driver such that this function can be removed.

include/linux/blk-mq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ void blk_freeze_queue_start(struct request_queue *q);
925925
void blk_mq_freeze_queue_wait(struct request_queue *q);
926926
int blk_mq_freeze_queue_wait_timeout(struct request_queue *q,
927927
unsigned long timeout);
928+
void blk_mq_unfreeze_queue_non_owner(struct request_queue *q);
929+
void blk_freeze_queue_start_non_owner(struct request_queue *q);
928930

929931
void blk_mq_map_queues(struct blk_mq_queue_map *qmap);
930932
void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);

0 commit comments

Comments
 (0)