Re: [PATCH v7 7/8] blktrace: ensure our debugfs dir exists

Bart Van Assche
2020-06-20T17:33:37Z

On 2020-06-19 13:47, Luis Chamberlain wrote:
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index e6e2d25fdbd6..098780ec018f 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -538,6 +538,18 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
> #endif
> bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root);
>
> + /*
> + * As blktrace relies on debugfs for its interface the debugfs directory
> + * is required, contrary to the usual mantra of not checking for debugfs
> + * files or directories.
> + */
> + if (IS_ERR_OR_NULL(dir)) {
> + pr_warn("debugfs_dir not present for %s so skipping\n",
> + buts->name);

Maybe mention in the message what is being skipped (block tracing)?

> + ret = -ENOENT;
> + goto err;
> + }
> +
> bt->dev = dev;
> atomic_set(&bt->dropped, 0);
> INIT_LIST_HEAD(&bt->running_list);

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>