]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: don't hold device refcount in IO path
authorMing Lei <ming.lei@redhat.com>
Fri, 12 Apr 2019 03:30:32 +0000 (11:30 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 16 Apr 2019 02:11:22 +0000 (22:11 -0400)
commit30314e2a4e577ece07afe6f9874682844ad4dfde
treeb87e6bea0551c833556a529c8b2eb0a8c72970ed
parent49015ba2666a8d0a0002ec67af95ed1a9a3d38c6
scsi: core: don't hold device refcount in IO path

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: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c