OSDN Git Service

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)
commit18c4f0a42b08ced680aa287a9cf3c94b6f9a752f
treeb87e6bea0551c833556a529c8b2eb0a8c72970ed
parent1710ac17547ac8b5c44fbd74de41dee3fe26ee81
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