On Fri, Oct 04, 2024 at 01:21:27PM +0900, Sergey Senozhatsky wrote: > Dunno. Is something like this completely silly? __blk_mark_disk_dead got moved into the lock by: 7e04da2dc701 ("block: fix deadlock between sd_remove & sd_release"), which has a trace that looks very similar to the one your reported. And that commit also points out something I missed - we do not set QUEUE_FLAG_DYING here because the gendisk does not own the queue for SCSI. Because of that allocating the request in sd/sr will not fail, and it will deadlock. So I think the short term fix is to also fail passthrough request here - either by clearing and resurrecting QUEUE_FLAG_DYING or by also checking q->disk for GD_DEAD if it exists. Both of these are a bit ugly because they will fail passthrough through /dev/sg during the removal which is unexpected (although probably not happening for usual workloads). The proper fix would be to split the freezing mechanism for file system vs passthrough I/O, but that's going to be a huge change.