On Wed, Apr 3, 2019 at 12:03 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On Tue, 2019-04-02 at 19:48 +0800, Ming Lei wrote: > > scsi_device's refcount is always grabed in IO path. > ^^^^^^ > grabbed? > > > Turns out it isn't necessary, becasue blk_queue_cleanup() will > > drain any in-flight IOs, then cancel timeout/requeue work, and > > SCSI's requeue_work is canceled too in __scsi_remove_device(). > > > > Also scsi_device won't go away until blk_cleanup_queue() is done. > > > > So don't hold the refcount in IO path. > > Holding the device reference count was definitely necessary in the past. > You may want to reflect this in the patch description by mentioning that > grabbing that reference count is no longer required today because the > draining mechanism now waits for requeuing to occur. I don't think that > was the case for the legacy block layer. You must forget we have switched to blk_queue_enter() for legacy block layer for a while, :-) Thanks, Ming Lei