aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-07-16target: Remove hba param from core_dev_add_lunAndy Grover3-6/+3
Only used in a debugprint, and function signature is cleaner now. Signed-off-by: Andy Grover <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: Remove unneeded double parenthesesAndy Grover4-8/+8
Signed-off-by: Andy Grover <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: replace the processing thread with a TMR work queueChristoph Hellwig4-223/+19
The last functionality of the target processing thread is offloading possibly long running task management requests from the submitter context. To keep TMR semantics the same we need a single threaded ordered queue, which can be provided by a per-device workqueue with the right flags. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove transport_generic_handle_cdb_mapChristoph Hellwig5-66/+1
Remove this command submission path which is not used by any in-tree driver. This also removes the now unused new_cmd_map fabtric method, which a few drivers implemented despite never calling transport_generic_handle_cdb_map. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: simply fabric driver queue full processingChristoph Hellwig1-7/+6
There is no need to schedule the delayed processing in a workqueue that offloads it to the target processing thread. Instead execute it directly from the workqueue. There will be a lot of future work in this area, which I'd likfe to defer for now as it is not nessecary for getting rid of the target processing thread. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove transport_generic_handle_dataChristoph Hellwig3-41/+0
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16tcm_fc: Offload WRITE I/O backend submission to tpg workqueueChristoph Hellwig1-2/+11
Defer the write processing to the internal to be able to use target_execute_cmd. I'm not even entirely sure the calling code requires this due to the convoluted structure in libfc, but let's be safe for now. Signed-off-by: Christoph Hellwig <[email protected]> Cc: Mark Rustad <[email protected]> Cc: Kiran Patil <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16tcm_qla2xxx: Offload WRITE I/O backend submission to tcm_qla2xxx wqChristoph Hellwig2-29/+19
Defer the whole tcm_qla2xxx_handle_data call instead of just the error path to the qla2xxx-internal workqueue. Also remove the useless lock around the CMD_T_ABORTED check. Signed-off-by: Christoph Hellwig <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Giridhar Malavali <[email protected]> Cc: [email protected] Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16srpt: use target_execute_cmd for WRITEs in srpt_handle_rdma_compChristoph Hellwig1-5/+10
srpt_handle_rdma_comp is called from kthread context and thus can execute target_execute_cmd directly. srpt_abort_cmd sets the CMD_T_LUN_STOP flag directly, and thus the abuse of transport_generic_handle_data can be replaced with an opencoded variant of that code path. I'm still not happy about a fabric driver poking into target core internals like this, but let's defer the bigger architecture changes for now. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16iscsit: use target_execute_cmd for WRITEsChristoph Hellwig3-5/+8
All three callers of transport_generic_handle_data are from user context and can use target_execute_cmd directly to handle the backend I/O submission of WRITE I/O. Signed-off-by: Christoph Hellwig <[email protected]> Cc: Andy Grover <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: merge transport_generic_write_pending into transport_generic_new_cmdChristoph Hellwig1-48/+26
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: call transport_check_aborted_status from target_execute_cmdChristoph Hellwig1-0/+6
When we call target_execute_cmd for write commands the command has been on the state list before an abort might have come in before target_execute_cmd. Call transport_check_aborted_status to deal with this case. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove transport_generic_process_writeChristoph Hellwig5-18/+8
Just call target_execute_cmd directly. Also, convert loopback, sbp, usb-gadget to use the newly exported target_execute_cmd(). Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: split transport_cmd_check_stopChristoph Hellwig1-62/+62
Inline the transport_off == 0 case into target_execute_cmd to simplify the function for the remaining cases. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16tcm_qla2xxx: Remove duplicate header file inclusionSachin Kamat1-2/+0
ctype.h and string.h header files were included more than once. Signed-off-by: Sachin Kamat <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16Revert "target: Do not special-case loop and iscsi fabric module loads"Nicholas Bellinger1-0/+38
Existing lio_dump.py code expects this to be in place for /iscsi. Revert for now to avoid userspace breakage in lio-utils This reverts commit fd88a785f9ac5d6be437c528571ccd85cdf2d493. Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move unmap to struct spc_opsChristoph Hellwig3-64/+50
Having all the unmap payload parsing in the backed is a bit ugly, but until more drivers support it and we can find a good interface for all of them that seems the way to go. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move write_same to struct spc_opsChristoph Hellwig3-34/+38
Add spc_ops->execute_write_same() caller for ->execute_cmd() setup, and update IBLOCK backends to use it. (nab: add export of spc_get_write_same_sectors symbol) (roland: Carry forward: Fix range calculation in WRITE SAME emulation when num blocks == 0) Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move sync_cache to struct spc_opsChristoph Hellwig4-20/+13
Add spc_ops->execute_sync_cache() caller for ->execute_cmd() setup, and update IBLOCK + FILEIO backends to use it. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: add struct spc_ops + initial ->execute_rw pointer usageChristoph Hellwig7-25/+66
Remove the execute_cmd method in struct se_subsystem_api, and always use the one directly in struct se_cmd. To make life simpler for SBC virtual backends a struct spc_ops that is passed to sbc_parse_cmd is added. For now it only contains an execute_rw member, but more will follow with the subsequent commits. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove dead SCF_ flagsChristoph Hellwig2-3/+0
Remove the dead SCF_SE_ALLOW_EOO and SCF_DELAYED_CMD_FROM_SAM_ATTR from se_cmd_flags_table. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target/iscsi: Remove dead code in lio_get_tpg_from_tpg_item()Roland Dreier1-22/+0
It's got no callers... Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target/iblock: Add parameter to specify read-only devicesAndy Grover2-7/+29
see https://bugzilla.redhat.com/show_bug.cgi?id=818855 Adds a parameter so read-only block devices may be registered as LIO backstores. Signed-off-by: Andy Grover <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: Do not special-case loop and iscsi fabric module loadsAndy Grover1-38/+0
These modules, along with other fabrics, should be loaded as-needed by the LIO userspace tools. Signed-off-by: Andy Grover <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move ref_cmd from the generic se_tmr_req into iscsi codeChristoph Hellwig3-26/+21
Also remove the unused ref_task_lun field in struct se_tmr_req. (nab: Add missing TASK_REASSIGN ref_lun vs. ref_cmd orig_fe_lun checks in iscsit_tmr_task_reassign) Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove the execute listChristoph Hellwig4-239/+98
Since "target: Drop se_device TCQ queue_depth usage from I/O path" we always submit all commands (or back then, tasks) from __transport_execute_tasks. That means the the execute list has lots its purpose, as we can simply submit the commands that are restarted in transport_complete_task_attr directly while we walk the list. In fact doing so also solves a race in the way it currently walks to delayed_cmd_list as well. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target/pscsi: Only emulate REPORT_LUNS for passthroughNicholas Bellinger1-9/+3
This patch changes back the pSCSI backend to follow pre 3.6-queue code to passthrough SPC-3 persistent reservations + SPC-2 legacy reservation handling to the underlying LLD / physical hardware. For folks who really need this for their own SPC-3 emulation logic, avoid changing the functionality of this beyond what is exported for REPORT_LUNS for existing code, and to avoid problems with SPC-3 PR/ALUA as INQUIRY EVPD=0x83 emulation needs to be in place in order for this to work as expected with spc_parse_cdb() code.. Cc: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: Move MAINTENANCE_[IN,OUT] from pscsi_parse_cdb -> spc_parse_cdbNicholas Bellinger1-1/+41
The MAINTENANCE_[IN,OUT] CDB parsing required for generic ALUA emulation needs to be in spc_parse_cdb() to function for virtual TYPE_DISK exports, instead of in backend pscsi_parse_cdb() code used only for passthrough ops. Cc: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move transport_generic_prepare_cdb into pscsiChristoph Hellwig2-29/+26
The virtual drivers don't need to clear cdb fields they never look at, so move this code into the pscsi backend. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move code for CDB emulationChristoph Hellwig8-1661/+1155
Move the existing code in target_core_cdb.c into the files for the command sets that the emulations implement. (roland + nab: Squash patch: Fix range calculation in WRITE SAME emulation when num blocks == 0s) Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: add a parse_cdb method to the backend driversChristoph Hellwig10-733/+936
Instead of trying to handle all SCSI command sets in one function (transport_generic_cmd_sequencer) call out to the backend driver to perform this functionality. For pSCSI a copy of the existing code is used, but for all virtual backends we can use a new parse_sbc_cdb helper is used to provide a simple SBC emulation. For now this setups means a fair amount of duplication between pSCSI and the SBC library, but patches later in this series will sort out that problem. (nab: Fix up build failure in target_core_pscsi.c) Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: split parsing of SPC commands into a separate helperChristoph Hellwig4-109/+176
(nab: Add EXPORT_SYMBOL usage for spc_parse_cdb) Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: split overflow and underflow checks into a helperChristoph Hellwig1-37/+53
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: remove control CDB flagsChristoph Hellwig5-101/+56
We don't need three flags to classifiy the CDB as we can check for a NULL S/G list for a dataless command, and can infer from the absence of the data flag that we deal with a control CDB. Also remove the _SG_IO from the data CDB flag as all I/O is dont on S/G lists now. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: move unrelated code out of transport_generic_cmd_sequencerChristoph Hellwig1-77/+66
Move all code not related to cdb parsing from transport_generic_cmd_sequencer into target_setup_cmd_from_cdb. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: Fix range calculation in WRITE SAME emulation when num blocks == 0Roland Dreier1-1/+1
When NUMBER OF LOGICAL BLOCKS is 0, WRITE SAME is supposed to write all the blocks from the specified LBA through the end of the device. However, dev->transport->get_blocks(dev) (perhaps confusingly) returns the last valid LBA rather than the number of blocks, so the correct number of blocks to write starting with lba is dev->transport->get_blocks(dev) - lba + 1 (nab: Backport roland's for-3.6 patch to for-3.5) Signed-off-by: Roland Dreier <[email protected]> Cc: Cc: <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-16target: Clean up returning errors in PR handling codeRoland Dreier1-3/+4
- instead of (PTR_ERR(file) < 0) just use IS_ERR(file) - return -EINVAL instead of EINVAL - all other error returns in target_scsi3_emulate_pr_out() use "goto out" -- get rid of the one remaining straight "return." Signed-off-by: Roland Dreier <[email protected]> Cc: <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-14tcm_fc: Fix crash seen with aborts and large readsMark Rustad1-0/+2
This patch fixes a crash seen when large reads have their exchange aborted by either timing out or being reset. Because the exchange abort results in the seq pointer being set to NULL, because the sequence is no longer valid, it must not be dereferenced. This patch changes the function ft_get_task_tag to return ~0 if it is unable to get the tag for this reason. Because the get_task_tag interface provides no means of returning an error, this seems like the best way to fix this issue at the moment. Signed-off-by: Mark Rustad <[email protected]> Cc: <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-06qla2xxx: print the right array elements in qlt_async_eventAlan Cox1-17/+18
Based upon Alan's patch from Coverity scan id 793583, these debug messages in qlt_async_event() should be starting from byte 0, which is always the Asynchronous Event Status Code from the parent switch statement. Also, rename reason_code -> login_code following the language used in 2500 FW spec for Port Database Changed (0x8014) -> Port Database Changed Event Mailbox Register for mailbox[2]. Signed-off-by: Alan Cox <[email protected]> Cc: Chad Dupuis <[email protected]> Cc: Giridhar Malavali <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-07-06tcm_fc: Resolve suspicious RCU usage warningsMark Rustad1-1/+2
Use rcu_dereference_protected to tell rcu that the ft_lport_lock is held during ft_lport_create. This resolved "suspicious RCU usage" warnings when debugging options are turned on. Signed-off-by: Mark Rustad <[email protected]> Tested-by: Ross Brattain <[email protected]> Cc: <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12qla2xxx: Remove version.h header file inclusionSachin Kamat2-2/+0
version.h header file is no longer required for qla_target code. Signed-off-by: Sachin Kamat <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12tcm_qla2xxx: Handle malformed wwn strings properlyRoland Dreier1-1/+3
If we make a variable an unsigned int and then expect it to be < 0 on a bad character, we're going to have a bad time. Fix the tcm_qla2xxx code to actually notice if hex_to_bin() returns a negative variable. This was detected by the compiler warning: scsi/qla2xxx/tcm_qla2xxx.c: In function ‘tcm_qla2xxx_npiv_extract_wwn’: scsi/qla2xxx/tcm_qla2xxx.c:148:3: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12tcm_qla2xxx: tcm_qla2xxx_handle_tmr() can be staticRoland Dreier1-2/+2
Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12qla2xxx: Don't leak commands we give up on in qlt_do_work()Roland Dreier1-1/+3
If we go to the "out_term:" exit path in qlt_do_work(), we call qlt_send_term_exchange() with a NULL cmd, which means that it can't possibly free the cmd for us. Add an explicit call to free the command memory, so we don't leak the allocation. This will also fix warnings about "BUG qla_tgt_cmd_cachep: Objects remaining on kmem_cache_close" from slub when unloading the qla2xxx target module. Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12qla2xxx: Don't crash if we can't find cmd for failed CTIORoland Dreier1-4/+2
In qlt_do_ctio_completion(), there's no point in calling qlt_term_ctio_exchange() with a NULL cmd -- all that it does is crash in a NULL pointer dereference, since it does qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); and dereferencing &cmd->atio is a bad idea if cmd itself is NULL. If we really need to do this, we could take the values from the failed CTIO we're processing, but it's not clear if it's worth the replumbing to do that. Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12tcm_qla2xxx: Don't insert nacls without sessions into the btreeRoland Dreier1-73/+0
When we create an explicit node ACL in tcm_qla2xxx_make_nodeacl(), there is a call to tcm_qla2xxx_setup_nacl_from_rport(), which puts the node ACL into the lport_fcport_map even though there is no session yet for the initiator. Since the only time we remove entries from this map is when we free a session, this means that if we later delete this node ACL without the initiator ever creating a session, we'll leave the nacl pointer in the btree pointing at freed memory. This is especially bad if that initiator later does send us a command that would cause us to create a dynamic ACL and session: we'll find the stale freed nacl pointer in the btree and end up with use-after-free. We could add more code to clear the btree entry when deleting the explicit nacl, but the original insertion is pointless: without a session attached, we'll just have to update the entry when a session appears anyway. So we can just delete tcm_qla2xxx_setup_nacl_from_rport() and the code that calls it. Signed-off-by: Roland Dreier <[email protected]> Cc: Chad Dupuis <[email protected]> Cc: Giridhar Malavali <[email protected]> Cc: Arun Easi <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12target: Return error to initiator if SET TARGET PORT GROUPS emulation failsRoland Dreier1-2/+3
The error paths in target_emulate_set_target_port_groups() are all essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores rc and always returns success. This means that even if eg explicit ALUA is turned off, the initiator will always see a good SCSI status for SET TARGET PORT GROUPS. Fix this by returning rc as is intended. It appears this bug was added by the following patch: commit 05d1c7c0d0db4cc25548d9aadebb416888a82327 Author: Andy Grover <[email protected]> Date: Wed Jul 20 19:13:28 2011 +0000 target: Make all control CDBs scatter-gather Signed-off-by: Roland Dreier <[email protected]> Cc: Andy Grover <[email protected]> Cc: <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12tcm_qla2xxx: Clear session s_id + loop_id earlier during shutdownNicholas Bellinger1-17/+31
This patch adds a new tcm_qla2xxx_clear_sess_lookup() call to clear session specific s_id + loop_id entries used for se_node_acl pointer lookup ahead of releasing se_session within the process context workqueue callback in tcm_qla2xxx_free_session(). It makes the call in existing tcm_qla2xxx_clear_nacl_from_fcport_map() code invoked from qlt_unreg_sess() in interrupt context w/ hardware_lock held, ahead of the process context callback into qlt_free_session_done() -> tcm_qla2xxx_free_session(). We are doing this to address a race between incoming ATIO or TMR packets using stale se_node_acl pointer once session shutdown has been invoked via qlt_unreg_sess() in qla_target.c LLD code, and when the entire tcm_qla2xxx endpoint has not been forced into shutdown w/ echo 0 > ../$QLA2XXX_PORT/enable Cc: Joern Engel <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Arun Easi <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12tcm_qla2xxx: Convert to TFO->put_session() usageJoern Engel1-1/+22
This patch converts tcm_qla2xxx code to use an internal kref_put() for se_session->sess_kref in order to ensure that qla_hw_data->hardware_lock can be held while calling qlt_unreg_sess() for the final put. Signed-off-by: Joern Engel <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Arun Easi <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2012-06-12target: Add TFO->put_session() caller for HW fabric session shutdownJoern Engel2-1/+8
This patch adds an optional target_core_fabric_ops->put_session() caller within the existing target_put_session() code path. This is required by tcm_qla2xxx code in order to invoke it's own fabric specific session shutdown handler using se_session->sess_kref. Signed-off-by: Joern Engel <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Arun Easi <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>