summaryrefslogtreecommitdiffstats
path: root/block/blk-rq-qos.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-14 09:48:25 +0200
committerJens Axboe <axboe@kernel.dk>2022-06-17 15:31:05 +0200
commit5cf9c91ba927119fc6606b938b1895bb2459d3bc (patch)
treec6d3d7b1806f35e8fff9c439285324c6feeddad5 /block/blk-rq-qos.c
parentblock: disable the elevator int del_gendisk (diff)
downloadlinux-5cf9c91ba927119fc6606b938b1895bb2459d3bc.tar.xz
linux-5cf9c91ba927119fc6606b938b1895bb2459d3bc.zip
block: serialize all debugfs operations using q->debugfs_mutex
Various places like I/O schedulers or the QOS infrastructure try to register debugfs files on demans, which can race with creating and removing the main queue debugfs directory. Use the existing debugfs_mutex to serialize all debugfs operations that rely on q->debugfs_dir or the directories hanging off it. To make the teardown code a little simpler declare all debugfs dentry pointers and not just the main one uncoditionally in blkdev.h. Move debugfs_mutex next to the dentries that it protects and document what it is used for. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220614074827.458955-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-rq-qos.c')
-rw-r--r--block/blk-rq-qos.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index e83af7bc7591..249a6f05dd3b 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -294,7 +294,9 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
void rq_qos_exit(struct request_queue *q)
{
+ mutex_lock(&q->debugfs_mutex);
blk_mq_debugfs_unregister_queue_rqos(q);
+ mutex_unlock(&q->debugfs_mutex);
while (q->rq_qos) {
struct rq_qos *rqos = q->rq_qos;