[PATCH v2 09/10] block: panic if block debugfs dir is not created
From: Luis Chamberlain
Date: Sun Apr 19 2020 - 15:46:00 EST
If DEBUG_FS is disabled we have another inline
blk_debugfs_register() which just returns 0.
If BLK_DEV_IO_TRACE is enabled we rely on the block debugfs
directory to have been created. If BLK_DEV_IO_TRACE is not enabled
though, but if debugfs is still enabled we will always create a
debugfs directory for a request_queue. Instead of special-casing
this just for BLK_DEV_IO_TRACE, ensure this block debugfs dir is
always created at boot if we have enabled debugfs.
Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
block/blk-debugfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-debugfs.c b/block/blk-debugfs.c
index 761318dcbf40..d6ec980e7531 100644
--- a/block/blk-debugfs.c
+++ b/block/blk-debugfs.c
@@ -15,6 +15,8 @@ struct dentry *blk_debugfs_root;
void blk_debugfs_register(void)
{
blk_debugfs_root = debugfs_create_dir("block", NULL);
+ if (!blk_debugfs_root)
+ panic("Failed to create block debugfs directory\n");
}
int __must_check blk_queue_debugfs_register(struct request_queue *q)
--
2.25.1