Thread (19 messages) 19 messages, 3 authors, 2025-11-22

Re: [PATCH v2 2/9] blk-rq-qos: fix possible debugfs_mutex deadlock

From: Nilay Shroff <hidden>
Date: 2025-11-21 10:41:13


On 11/21/25 11:58 AM, Yu Kuai wrote:
+void blkg_conf_exit(struct blkg_conf_ctx *ctx)
+{
+	__blkg_conf_exit(ctx);
+	if (ctx->bdev) {
+		struct request_queue *q = ctx->bdev->bd_queue;
+
+		mutex_lock(&q->debugfs_mutex);
+		blk_mq_debugfs_register_rq_qos(q);
+		mutex_unlock(&q->debugfs_mutex);
+
 		ctx->bdev = NULL;
 	}
 }
Why do we need to add debugfs register from blkg_conf_exit() here?
Does any caller using above API, really registers/adds q->rqos? I
see blk-iococst, blk-iolatency and wbt don't use this API.

quoted hunk ↗ jump to hunk
@@ -724,8 +724,12 @@ void wbt_enable_default(struct gendisk *disk)
 	if (!blk_queue_registered(q))
 		return;
 
-	if (queue_is_mq(q) && enable)
+	if (queue_is_mq(q) && enable) {
 		wbt_init(disk);
+		mutex_lock(&q->debugfs_mutex);
+		blk_mq_debugfs_register_rq_qos(q);
+		mutex_unlock(&q->debugfs_mutex);
+	}
 }
 EXPORT_SYMBOL_GPL(wbt_enable_default);
I see we do have still one code path left in which the debugfs register 
could be invoked while queue remains freezed:

ioc_qos_write:
blkg_conf_open_bdev_frozen        => freezs the queue
  wbt_enable_default
    blk_mq_debugfs_register_rq_qos
      
Thanks,
--Nilay
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help