scsi: proper state checking and module refcount handling in scsi_device_get
authorChristoph Hellwig <hch@lst.de>
Mon, 2 Feb 2015 13:01:26 +0000 (14:01 +0100)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 19 Mar 2015 13:43:15 +0000 (06:43 -0700)
commitcff549e4860fcdea6b22510defdc8c8a0f82455a
tree62b1d3e75ba06f46593883beb0ef48ac684907a3
parent3d9a1f530e508ff6fc9ab8220016b02f1bce255b
scsi: proper state checking and module refcount handling in scsi_device_get

This effectively reverts commits 85b6c7 ("[SCSI] sd: fix cache flushing on
module removal (and individual device removal)" and dc4515ea ("scsi: always
increment reference count").

We now never call scsi_device_get from the shutdown path, and the fact
that we started grabbing reference there in commit 85b6c7 turned out
turned out to create more problems than it solves, and required
workarounds for workarounds for workarounds. Move back to properly checking
the device state and carefully handle module refcounting.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi.c