Re: [PATCH] block: rename 'q->debugfs_dir' in blk_unregister_queue()

From: Bart Van Assche
Date: Tue Feb 11 2020 - 22:27:30 EST


On 2020-02-10 19:51, yu kuai wrote:
> +static struct dentry *blk_prepare_release_queue(struct request_queue *q)
> +{
> + struct dentry *new = NULL;
> + char name[DNAME_INLINE_LEN];
> + int i = 0;
> +
> + if (IS_ERR_OR_NULL(q->debugfs_dir))
> + return q->debugfs_dir;
> +
> + while (new == NULL) {
> + sprintf(name, "ready_to_remove_%d", i++);
> + new = debugfs_rename(blk_debugfs_root, q->debugfs_dir,
> + blk_debugfs_root, name);
> + }
> +
> + return new;
> +}

What is the behavior of this loop if multiple block devices are being
removed concurrently? Does it perhaps change remove block device removal
from an O(1) into an O(n) operation?

Since this scenario may only matter to syzbot tests: has it been
considered to delay block device creation if the debugfs directory from
a previous incarnation of the block device still exists?

Thanks,

Bart.