IB/srp: Keep rport as long as the IB transport layer
authorBart Van Assche <bvanassche@acm.org>
Sat, 26 Oct 2013 12:32:30 +0000 (14:32 +0200)
committerRoland Dreier <roland@purestorage.com>
Fri, 8 Nov 2013 22:43:15 +0000 (14:43 -0800)
commit9dd69a600a680fab1c9235a644c886d8d6a2da2a
tree844b8e5cf7e9ff7638eb5b5dd32c40d55c974733
parent7bb312e4a2f323fa460bbf9f33eeb00b5dabdb6b
IB/srp: Keep rport as long as the IB transport layer

Keep the rport data structure around after srp_remove_host() has
finished until cleanup of the IB transport layer has finished
completely. This is necessary because later patches use the rport
pointer inside the queuecommand callback. Without this patch
accessing the rport from inside a queuecommand callback is racy
because srp_remove_host() must be invoked before scsi_remove_host()
and because the queuecommand callback could get invoked after
srp_remove_host() has finished. In other words, without this patch
the queuecommand callback can get invoked after the rport data
structure has been freed.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: David Dillow <dillowda@ornl.gov>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.h
drivers/scsi/scsi_transport_srp.c
include/scsi/scsi_transport_srp.h