Skip to contentSkip to conversation

blk-mq: fix up placement of debugfs directory of queue files

PATCH In review Greg Kroah-Hartman 2 participants 3 messages Jul 6, 2019

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 blk-mq: fix up placement of debugfs directory of queue files

When the blk-mq debugfs file creation logic was "cleaned up" it was cleaned up too much, causing the queue file to not be created in the correct location. Turns out the check for the directory being present is needed as if that has not happened yet, the files should not be created, and the function will be called later on in the initialization code so that the files can be created in the correct location.

Fixes 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_create functions")
Cc Jens Axboe <[email protected]>
Cc stable <[email protected]> # 5.2+
---
 block/blk-mq-debugfs.c | 7 +++++++
 1 file changed, 7 insertions(+)
block/blk-mq-debugfs.c +7 -0
index 2489ddbb21db..3afe327f816f 100644
@@ -934,6 +934,13 @@ void blk_mq_debugfs_register_sched(struct request_queue *q)
 {
 	struct elevator_type *e = q->elevator->type;
 
+	/*
+	 * If the parent directory has not been created yet, return, we will be
+	 * called again later on and the directory/files will be created then.
+	 */
+	if (!q->debugfs_dir)
+		return;
+
 	if (!e->queue_debugfs_attrs)
 		return;
 
Signature · 1 line
2.22.0
maintainer
#1 lore raw
Quoted 6 lines · Greg Kroah-Hartman

When the blk-mq debugfs file creation logic was "cleaned up" it was cleaned up too much, causing the queue file to not be created in the correct location. Turns out the check for the directory being present is needed as if that has not happened yet, the files should not be created, and the function will be called later on in the initialization code so that the files can be created in the correct location.

How about we shove this in for 5.2 final? Trivial enough to do, and it would suck to have 5.2 released with this. Though not sure what devices this actually impacts, I haven't noticed anything awry on my setups?

Signature · 1 line
Jens Axboe
author maintainer
#2 lore raw
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Greg Kroah-Hartman

When the blk-mq debugfs file creation logic was "cleaned up" it was cleaned up too much, causing the queue file to not be created in the correct location. Turns out the check for the directory being present is needed as if that has not happened yet, the files should not be created, and the function will be called later on in the initialization code so that the files can be created in the correct location.

How about we shove this in for 5.2 final? Trivial enough to do, and it would suck to have 5.2 released with this.

Sure, no objection from me!

Quoted 2 lines

Though not sure what devices this actually impacts, I haven't noticed anything awry on my setups?

I can easily trigger this with loop devices. I know Stephen reported this and I don't know if that was the driver that caused it for him. I have also seen this happen in syzbot boot logs already, but again, don't know what block devices they are using that causes this.

thanks,

greg k-h