scsi: srp_transport: Move queuecommand() wait code to SCSI core
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 23 Nov 2016 00:17:13 +0000 (16:17 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 29 Nov 2016 16:21:27 +0000 (11:21 -0500)
commit669f044170d8933c3d66d231b69ea97cb8447338
tree7dfa2438e08cab47446b431a1e5990e58ef439f9
parent27c3d76821a5f563cd3d760bfa7c8deb43f8d874
scsi: srp_transport: Move queuecommand() wait code to SCSI core

Additionally, rename srp_wait_for_queuecommand() into
scsi_wait_for_queuecommand() and add a comment about the queuecommand()
call from scsi_send_eh_cmnd().

Note: this patch changes scsi_internal_device_block from a function that
did not sleep into a function that may sleep. This is fine for all
callers of this function:

* scsi_internal_device_block() is called from the mpt3sas device while
  that driver holds the ioc->dm_cmds.mutex. This means that the mpt3sas
  driver calls this function from thread context.
* scsi_target_block() is called by __iscsi_block_session() from
  kernel thread context and with IRQs enabled.
* The SRP transport code also calls scsi_target_block() from kernel
  thread context while sleeping is allowed.
* The snic driver also calls scsi_target_block() from a context from
  which sleeping is allowed. The scsi_target_block() call namely occurs
  immediately after a scsi_flush_work() call.

[mkp: s/shost/sdev/]

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: James Bottomley <jejb@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Doug Ledford <dledford@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_transport_srp.c