• Ming Lei's avatar
    scsi: core: don't hold device refcount in IO path · 18c4f0a4
    Ming Lei authored
    scsi_device's refcount is always grabbed in IO path.
    
    Turns out it isn't necessary, because 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, especially the refcount isn't
    required in IO path since blk_queue_enter() / blk_queue_exit() is
    introduced in the legacy block layer.
    
    Cc: Dongli Zhang <dongli.zhang@oracle.com>
    Cc: James Smart <james.smart@broadcom.com>
    Cc: Bart Van Assche <bart.vanassche@wdc.com>
    Cc: linux-scsi@vger.kernel.org,
    Cc: Martin K . Petersen <martin.petersen@oracle.com>,
    Cc: Christoph Hellwig <hch@lst.de>,
    Cc: James E . J . Bottomley <jejb@linux.vnet.ibm.com>,
    Cc: jianchao wang <jianchao.w.wang@oracle.com>
    Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
    Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    18c4f0a4
scsi_lib.c 80.1 KB