On Wed, Jun 01, 2022 at 05:07:53PM +0800, Ming Lei wrote: > > > I am afraid the above way may slow down disk shutdown a lot, see > > > the following commit, that is also the reason why I moved it into disk > > > release handler, when any sync io submission are done. > > > > SCSI devices that are just probed and never had a disk attached will > > not have q->elevator set and not hit this quiesce at all. > > Yes, but host with hundreds of real LUNs may be shutdown slowly too > since sd_remove() won't be called in async way. So maybe teardown will slow down. But we fix a reproducable bug, and do get the lifetimes right. The sched request are enabled in add_disk (or when a scheduler is enabled if there was none after that) so we should tear it down in del_gendisk. The fact that we've been playing so lose with these lifetime rules in the block layer has been a constant source of bugs.