Re: [PATCH] block: revert pushing the final release of request_queue to a workqueue.

From: yukuai (C)
Date: Mon Feb 10 2020 - 03:50:35 EST


On 2020/2/10 11:14, Bart Van Assche wrote:
I think that calling blk_mq_exit_queue() from blk_unregister_queue()
would break at least the sd driver. The sd driver can issue I/O after
having called del_gendisk(). See also the sd_sync_cache() call in
sd_shutdown().

If blk_mq_exit_queue() can't move to blk_unregister_queue(),
neither can blk_mq_debugfs_unregister(). It'a dead end.

The purpose is that when __blk_trace_setup() is called, the cleanup of
last loop_device(__blk_release_queue()) should finish aready.

I wonder if we can test that if the dir still exist in loop_add():

static int loop_add(struct loop_device **l, int i)
{
...
char disk_name[DISK_NAME_LEN];
struct dentry *dir, *root;

sprintf(disk_name, "loop%d", i);
root = debugfs_lookup("block", NULL);
if (root) {
dir = debugfs_lookup(disk_name, root);
if (dir) {
dput(dir);
dput(root);
pr_err("Directory '%s' with parent 'block' already present!\n",disk_name);
return -EBUSY;
}
dput(root);
}
...

Thanks!
Yu Kuai