Skip to contentSkip to conversation

blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created

PATCH Applied Ming Lei 5 participants 8 messages Jul 11, 2022 – Jul 12, 2022 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created

blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp.

Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!' which can be observed reliably when running blktests nvme/005.

---
 block/blk-mq-debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-mq-debugfs.c +3 -0
index b80fae7ab1d9..28adb01f6441 100644
@@ -728,6 +728,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue *q,
 	char name[20];
 	int i;
 
+	if (!q->debugfs_dir)
+		return;
+
 	snprintf(name, sizeof(name), "hctx%u", hctx->queue_num);
 	hctx->debugfs_dir = debugfs_create_dir(name, q->debugfs_dir);
 
Signature · 1 line
2.31.1
Tested-by on v1 1/1
#2 lore raw
In reply to Ming Lei

Verified on linux-block/for-next,

Quoted 30 lines · Ming Lei

blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp.

Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!' which can be observed reliably when running blktests nvme/005.

---
 block/blk-mq-debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-mq-debugfs.c +3 -1
index b80fae7ab1d9..28adb01f6441 100644
@@ -728,6 +728,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue *q,
        char name[20];
        int i;
 
+       if (!q->debugfs_dir)
+               return;
+
        snprintf(name, sizeof(name), "hctx%u", hctx->queue_num);
        hctx->debugfs_dir = debugfs_create_dir(name, q->debugfs_dir);
 
--

2.31.1

Signature · 2 lines
Best Regards,
  Yi Zhang
maintainer Applied
#3 lore raw
In reply to Ming Lei
Quoted 8 lines · Ming Lei

blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp.

Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!' which can be observed reliably when running blktests nvme/005.

[...]

Applied, thanks!

[1/1] blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created

      commit: 52b0e38ae7985386d5b5e4653cc20fc2c6c95ce9

Best regards,

Signature · 1 line
Jens Axboe
#4 lore raw
In reply to Ming Lei
Quoted 17 lines · Ming Lei

blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp.

Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!' which can be observed reliably when running blktests nvme/005.

---
  block/blk-mq-debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
block/blk-mq-debugfs.c +0 -0
index b80fae7ab1d9..28adb01f6441 100644

block/blk-mq-debugfs.c void blk_mq_debugfs_register_hctx(struct request_queue *q, · line 736

Quoted 9 lines
block/blk-mq-debugfs.c +3 -0
@@ -728,6 +728,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue *q,
  	char name[20];
  	int i;
 
+	if (!q->debugfs_dir)
+		return;
+
  	snprintf(name, sizeof(name), "hctx%u", hctx->queue_num);
  	hctx->debugfs_dir = debugfs_create_dir(name, q->debugfs_dir);
 

Does this patch need a Fixes: tag?

Additionally, as one can see here, I reported this bug before Yi: https://bugzilla.kernel.org/show_bug.cgi?id=216191

Thanks,

Bart.

author
#5 lore raw
Quoted 13 lines · Bart Van Assche
Quoted 12 lines · Ming Lei

blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp.

Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!' which can be observed reliably when running blktests nvme/005.

---
  block/blk-mq-debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
Quoted 14 lines

block/blk-mq-debugfs.c void blk_mq_debugfs_register_hctx(struct request_queue *q, · line 734

Quoted 12 lines
block/blk-mq-debugfs.c +3 -0
index b80fae7ab1d9..28adb01f6441 100644
@@ -728,6 +728,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue *q,
  	char name[20];
  	int i;
+	if (!q->debugfs_dir)
+		return;
+
  	snprintf(name, sizeof(name), "hctx%u", hctx->queue_num);
  	hctx->debugfs_dir = debugfs_create_dir(name, q->debugfs_dir);

Does this patch need a Fixes: tag?

Yeah,

Fixes 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_create functions")
Quoted 3 lines

Additionally, as one can see here, I reported this bug before Yi:
https://bugzilla.kernel.org/show_bug.cgi?id=216191

Sorry for missing your report, and I am fine to add your reported-by.

Thanks,
Ming

#6 lore raw
Quoted 5 lines · Ming Lei
Quoted 1 line · Bart Van Assche

Does this patch need a Fixes: tag?

Yeah,

Quoted 7 lines
Fixes 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_create functions")
Quoted 3 lines

Additionally, as one can see here, I reported this bug before Yi:
https://bugzilla.kernel.org/show_bug.cgi?id=216191

Sorry for missing your report, and I am fine to add your reported-by.

Hi Ming,

Since this patch is already in Jens' tree I will let Jens decide how to proceed.

Thanks,

Bart.

maintainer
#7 lore raw
Quoted 12 lines · Bart Van Assche
Quoted 11 lines · Ming Lei
Quoted 1 line · Bart Van Assche

Does this patch need a Fixes: tag?

Yeah,

Fixes 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_create functions")
Quoted 3 lines

Additionally, as one can see here, I reported this bug before Yi:
https://bugzilla.kernel.org/show_bug.cgi?id=216191

Quoted 6 lines
Quoted 1 line

Sorry for missing your report, and I am fine to add your reported-by.

Hi Ming,

Since this patch is already in Jens' tree I will let Jens decide how to proceed.

It was top of that branch, I did amend it this morning with the Fixes tag. I missed the reported-by, however... Sorry.

Signature · 1 line
Jens Axboe