History

block: create the request_queue debugfs_dir on registration

We were only creating the request_queue debugfs_dir only for make_request block drivers (multiqueue), but never for request-based block drivers. We did this as we were only creating non-blktrace additional debugfs files on that directory for make_request drivers. However, since blktrace *always* creates that directory anyway, we special-case the use of that directory on blktrace. Other than this being an eye-sore, this exposes request-based block drivers to the same debugfs fragile race that used to exist with make_request block drivers where if we start adding files onto that directory we can later run a race with a double removal of dentries on the directory if we don't deal with this carefully on blktrace. Instead, just simplify things by always creating the request_queue debugfs_dir on request_queue registration. Rename the mutex also to reflect the fact that this is used outside of the blktrace context.

Luis Chamberlain committed 6 years ago

Commit 85e0cbb1 parent b431ef86 files · +39 −48Browse files

Showing the changes to include/linux (1 of 6 files). Show all

Unified · Split

include/linux/blkdev.h+3−2
@@ -528,9 +528,9 @@ struct request_queue { · 527 unmodified lines
528 unsigned int sg_timeout;528 unsigned int sg_timeout;
529 unsigned int sg_reserved_size;529 unsigned int sg_reserved_size;
530 int node;530 int node;
531 struct mutex debugfs_mutex;
531#ifdef CONFIG_BLK_DEV_IO_TRACE532#ifdef CONFIG_BLK_DEV_IO_TRACE
532 struct blk_trace __rcu *blk_trace;533 struct blk_trace __rcu *blk_trace;
533 struct mutex blk_trace_mutex;
534#endif534#endif
535 /*535 /*
536 * for flush operations536 * for flush operations
@@ -574,8 +574,9 @@ struct request_queue { · 37 unmodified lines
574 struct list_head tag_set_list;574 struct list_head tag_set_list;
575 struct bio_set bio_split;575 struct bio_set bio_split;
576 576
577#ifdef CONFIG_BLK_DEBUG_FS
578 struct dentry *debugfs_dir;577 struct dentry *debugfs_dir;
578
579#ifdef CONFIG_BLK_DEBUG_FS
579 struct dentry *sched_debugfs_dir;580 struct dentry *sched_debugfs_dir;
580 struct dentry *rqos_debugfs_dir;581 struct dentry *rqos_debugfs_dir;
581#endif582#endif