]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
blk-rq-qos: fix possible debugfs_mutex deadlock
authorYu Kuai <yukuai@fnnas.com>
Mon, 2 Feb 2026 08:05:19 +0000 (16:05 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 2 Feb 2026 14:05:19 +0000 (07:05 -0700)
commit3c17a346ffc613615f48c6f1ed30cdf328bab805
treec925c72b283a1c458ff4ca147af1c8b3bcf44296
parent3f0bea9f3b9e7d9bdc3794103575168ef007d309
blk-rq-qos: fix possible debugfs_mutex deadlock

Currently rq-qos debugfs entries are created from rq_qos_add(), while
rq_qos_add() can be called while queue is still frozen. This can
deadlock because creating new entries can trigger fs reclaim.

Fix this problem by delaying creating rq-qos debugfs entries after queue
is unfrozen.

- For wbt, 1) it can be initialized by default, fix it by calling new
  helper after wbt_init() from wbt_init_enable_default(); 2) it can be
  initialized by sysfs, fix it by calling new helper after queue is
  unfrozen from wbt_set_lat().
- For iocost and iolatency, they can only be initialized by blkcg
  configuration, however, they don't have debugfs entries for now, hence
  they are not handled yet.

Signed-off-by: Yu Kuai <yukuai@fnnas.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-rq-qos.c
block/blk-wbt.c