Hello, On Thu, Apr 12, 2018 at 03:14:40PM +0200, hch@xxxxxx wrote: > > At least the SCSI ULP drivers drop the last reference to a disk after > > the blk_cleanup_queue() call. As explained in the description of commit > > a063057d7c73, removing a request queue from blkcg must happen before > > blk_cleanup_queue() finishes because a block driver may free the > > request queue spinlock immediately after blk_cleanup_queue() returns. > > So I don't think that we can move the code that removes a request > > queue from blkcg into put_disk(). Another challenge is that some block > > drivers (e.g. skd) clear the disk->queue pointer if device_add_disk() > > has not been called to avoid that put_disk() causes a request queue > > reference count imbalance. > > Which sounds like a very good reason not to use a driver controller > lock for internals like blkcq. > > In fact splitting the lock used for synchronizing access to queue > fields from the driver controller lock used to synchronize I/O > in the legacy path in long overdue. It'd be probably a lot easier to make sure the shared lock doesn't go away till all the request_queues using it go away. The choice is between refcnting something which carries the lock and double locking in hot paths. Can't think of many downsides of the former approach. Thanks. -- tejun