On Wed, Jul 20, 2022 at 11:00:40AM +0200, Christoph Hellwig wrote: > On Wed, Jul 20, 2022 at 03:47:27PM +0800, Ming Lei wrote: > > > What is broken in START_DEV/STOP_DEV? Please explain the semantics you > > > want and what doesn't work. FYI, there is nothing in the test suite the > > > complains. And besides the obvious block layer bug that Jens found you > > > seemed to be perfectly happy with the semantics. > > > > START_DEV calls add_disk(), and STOP_DEV calls del_gendisk(), but if > > GD_OWNS_QUEUE is set, blk_mq_exit_queue() will be called in > > del_gendisk(), then the following START_DEV will stuck. > > Uh, yeah. alloc_disk and add_disk are supposed to be paired and > not split over different ioctls. The lifetime rules here are > rather broken. Even though alloc_disk and add_disk is paired here, GD_OWNS_QUEUE still can't be set because request queue has to be workable for the new alloc/ added disk, just like scsi. So it is nothing to do with pair of alloc_disk/add_disk(). Not mention I don't see any thing wrong with adding/deleting disk multiple times. Thanks, Ming