On Sat, Oct 19, 2024 at 10:25:41AM +0900, Sergey Senozhatsky wrote: > On (24/10/16 21:35), Ming Lei wrote: > > On Wed, Oct 09, 2024 at 01:38:20PM +0200, Christoph Hellwig wrote: > > > When del_gendisk shuts down access to a gendisk, it could lead to a > > > deadlock with sd or, which try to submit passthrough SCSI commands from > > > their ->release method under open_mutex. The submission can be blocked > > > in blk_enter_queue while del_gendisk can't get to actually telling them > > > top stop and wake them up. > > > > When ->release() waits in blk_enter_queue(), the following code block > > > > mutex_lock(&disk->open_mutex); > > __blk_mark_disk_dead(disk); > > xa_for_each_start(&disk->part_tbl, idx, part, 1) > > drop_partition(part); > > mutex_unlock(&disk->open_mutex); > > blk_enter_queue()->schedule() holds ->open_mutex, so that block > of code sleeps on ->open_mutex. We can't drain under ->open_mutex. We don't start to drain yet, then why does blk_enter_queue() sleeps and it waits for what? Thanks, Ming