summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_srp.c
Commit message (Collapse)AuthorAgeFilesLines
* scsi_transport_srp: Fix kernel-doc warningsBart Van Assche2014-01-211-0/+12
| | | | | | | | | | | | | The following command has been used to verify that the kernel-doc tool no longer complains about undocumented fields: scripts/kernel-doc -html drivers/scsi/scsi_transport_srp.c \ include/scsi/scsi_transport_srp.h >srp-transport-doc.html Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Sebastian Riemer <sebastian.riemer@profitbricks.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
* scsi_transport_srp: Fix a race conditionBart Van Assche2014-01-211-40/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rport timers must be stopped before the SRP initiator destroys the resources associated with the SCSI host. This is necessary because otherwise the callback functions invoked from the SRP transport layer could trigger a use-after-free. Stopping the rport timers before invoking scsi_remove_host() can trigger long delays in the SCSI error handler if a transport layer failure occurs while scsi_remove_host() is in progress. Hence move the code for stopping the rport timers from srp_rport_release() into a new function and invoke that function after scsi_remove_host() has finished. This patch fixes the following sporadic kernel crash: kernel BUG at include/asm-generic/dma-mapping-common.h:64! invalid opcode: 0000 [#1] SMP RIP: 0010:[<ffffffffa03b20b1>] [<ffffffffa03b20b1>] srp_unmap_data+0x121/0x130 [ib_srp] Call Trace: [<ffffffffa03b20fc>] srp_free_req+0x3c/0x80 [ib_srp] [<ffffffffa03b2188>] srp_finish_req+0x48/0x70 [ib_srp] [<ffffffffa03b21fb>] srp_terminate_io+0x4b/0x60 [ib_srp] [<ffffffffa03a6fb5>] __rport_fail_io_fast+0x75/0x80 [scsi_transport_srp] [<ffffffffa03a7438>] rport_fast_io_fail_timedout+0x88/0xc0 [scsi_transport_srp] [<ffffffff8108b370>] worker_thread+0x170/0x2a0 [<ffffffff81090876>] kthread+0x96/0xa0 [<ffffffff8100c0ca>] child_rip+0xa/0x20 Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
* scsi_transport_srp: Block rport upon TL error even with fast_io_fail_tmo = offBart Van Assche2014-01-211-13/+17
| | | | | | | | | | | | | The current behavior of the SRP transport layer when a transport layer error is encountered is to block SCSI command processing only if fast_io_fail_tmo != off. The current behavior of the FC transport layer when a transport layer error is encountered is to block SCSI command processing no matter which value fast_io_fail_tmo has been set to. Make the behavior of the SRP transport layer consistent with that of the FC transport layer to avoid confusion. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
* scsi_transport_srp: Add periodic reconnect supportBart Van Assche2013-11-081-7/+99
| | | | | | | | | | Add support for periodically reconnecting to an SRP target until the dev_loss timer expires. After the tenth reconnection attempt, gradually slow down subsequent reconnect attempts. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
* scsi_transport_srp: Add transport layer error handlingBart Van Assche2013-11-081-1/+429
| | | | | | | | | | | | | | | | | | Add the necessary functions in the SRP transport module to allow an SRP initiator driver to implement transport layer error handling similar to the functionality already provided by the FC transport layer. This includes: - Support for implementing fast_io_fail_tmo, the time that should elapse after having detected a transport layer problem and before failing I/O. - Support for implementing dev_loss_tmo, the time that should elapse after having detected a transport layer problem and before removing a remote port. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
* IB/srp: Keep rport as long as the IB transport layerBart Van Assche2013-11-081-0/+18
| | | | | | | | | | | | | | | | | 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>
* IB/srp: Allow SRP disconnect through sysfsBart Van Assche2012-11-301-1/+21
| | | | | | | | | | | | | | Make it possible to disconnect the IB RC connection used by the SRP protocol to communicate with a target. Have the SRP transport layer create a sysfs "delete" attribute for initiator drivers that support this functionality. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Robert Jennings <rcj@linux.vnet.ibm.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
* srp_transport: Simplify attribute initialization codeBart Van Assche2012-11-301-22/+4
| | | | | | | | | | | | | | Eliminate the private_rport_attrs[] array and the SETUP_*() macros used to set up that array since the information in that array duplicates the information in the static device attributes. Also, verify whether SRP_RPORT_ATTRS is large enough since it is easy to forget to update that macro when adding new attributes. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Robert Jennings <rcj@linux.vnet.ibm.com> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
* srp_transport: Fix attribute registrationBart Van Assche2012-11-301-1/+2
| | | | | | | | | | | | | | | Register transport attributes after the attribute array has been set up instead of before. The current code can trigger a race condition because the code reading the attribute array can run on another thread than the code that initialized that array. Make sure that any code reading the attribute array will see all values written into that array. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Robert Jennings <rcj@linux.vnet.ibm.com> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
* [SCSI] struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers2009-01-021-1/+1
| | | | | | | | [jejb: limit ioctl to returning 20 characters to avoid overrun on long device names and add a few more conversions] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* SCSI: convert struct class_device to struct deviceTony Jones2008-04-191-12/+14
| | | | | | | | | | | | | It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [SCSI] docbook and kernel-doc updatesRandy Dunlap2008-01-111-2/+1
| | | | | | | | | | | - Change title to remove "Mid-Layer" since the doc is about all of the SCSI layers. - Use "SCSI" instead of "scsi" in docbook text. - Use "*/" to end kernel-doc notation blocks. - A few other minor typo fixes. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* [SCSI] Add Documentation and integrate into docbook buildRob Landley2008-01-111-5/+5
| | | | | | | | | | | Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update lots of kerneldoc comments in drivers/scsi/*. Updated with comments from Stefan Richter, Stephen M. Cameron, James Bottomley and Randy Dunlap. Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* [SCSI] SRP transport: only remove our own entriesDave Dillow2008-01-041-1/+2
| | | | | | | | | | | | The SCSI SRP transport class currently iterates over all children devices of the host that is being removed in srp_remove_host(). However, not all of those children were created by the SRP transport, and removing them will cause corruption and an oops when their creator tries to remove them. Signed-off-by: David Dillow <dillowda@ornl.gov> Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* [SCSI] srp_transport: convert to use supported_mode attributeFUJITA Tomonori2007-10-121-4/+6
| | | | | | | | srp transport works for target drivers without supported_mode attribute but it would be better to use it explicitly. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
* [SCSI] scsi_transport_srp: remove tgt dependenciesFUJITA Tomonori2007-10-121-5/+5
| | | | | | | | it's better to remove tgt dependencies in srp transport class since most people want only initiator support. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
* [SCSI] tgt: move tsk_mgmt_response callback to transport classFUJITA Tomonori2007-10-121-2/+10
| | | | | | | | | | This moves tsk_mgmt_response callback in struct scsi_host_template to struct scsi_transport_template since struct scsi_transport_template is more suitable for the task management stuff. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
* [SCSI] srp_transport: add target driver supportFUJITA Tomonori2007-10-121-0/+24
| | | | | | | | | | | | | | This adds minimum target driver support: - srp_rport_{add,del} calls scsi_tgt_it_nexus_{create,destroy} for target drivers. - add a callback to notify target drivers of the nexus operation results to srp_function_template. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
* [SCSI] transport_srp: add rport roles attributeFUJITA Tomonori2007-10-121-1/+28
| | | | | | | | | | This adds a 'roles' attribute to rport like transport_fc. The role can be initiator or target. That is, the initiator driver creates target remote ports and the target driver creates initiator remote ports. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
* [SCSI] add srp transport classFUJITA Tomonori2007-10-121-0/+320
This adds srp transport class that works with ib_srp and ibmvscsi. It creates only /sys/class/{srp_host,srp_remote_ports} and srp_remote_ports has only "port_id" attribute. viola:/sys/class/srp_remote_ports/port-0:1# ls device port_id subsystem uevent viola:/sys/class/srp_remote_ports/port-0:1# cat port_id 4c:49:4e:55:58:20:56:49:4f:00:00:00:00:00:00:00 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
OpenPOWER on IntegriCloud