summaryrefslogtreecommitdiffstats
path: root/drivers/target
Commit message (Collapse)AuthorAgeFilesLines
...
| * target: remove the task_size field in struct se_taskChristoph Hellwig2012-05-065-12/+12
| | | | | | | | | | | | | | | | | | | | Now that we don't split commands the size field in the task is always equivalent to the one in the CDB, even in cases where we have two tasks due to a BIDI transfer. Just refer the the size in the command instead of duplicating it in the task. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: remove the task_lba field in struct se_taskChristoph Hellwig2012-05-064-12/+14
| | | | | | | | | | | | | | | | | | | | Now that we don't split commands the lba field in the task is always equivalent to the one in the CDB, even in cases where we have two tasks due to a BIDI transfer. Just refer the the lba in the command instead of duplicating it in the task. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: remove target_get_task_cdbChristoph Hellwig2012-05-062-50/+2
| | | | | | | | | | | | | | | | | | | | Now that tasks are always the same size as the command there is no need to rewrite a CDB in common code. Notw that we keep the separately allocated CDB in the pscsi and stgt backends for now, to easy reintroducing any command splitting local to these backends if nessecary. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: remove the unused transport_limit_task_sectors helperChristoph Hellwig2012-05-061-15/+0
| | | | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Handle GET_EVENT_STATUS_NOTIFICATION passthroughStefan Hajnoczi2012-05-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | The SCSI MMC GET_EVENT_STATUS_NOTIFICATION command can be used to find out about media change, among other things. This patch adds it to the command sequencer so that PSCSI CD-ROM passthrough works with modern Linux guests that issue this command. Tested-by: Cong Meng <mengcong@cn.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: cleanup some allocation style issuesDan Carpenter2012-05-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | We can use kcalloc() here instead of kzalloc(). It's better style and it has overflow checking built in. Also -ENOMEM is the correct error code for allocation errors. -1 means -EPERM. None of the callers preserve the error codes so it doesn't matter except as a cleanup. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Go back to core allocating data buffer for cmdAndy Grover2012-04-143-80/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | We originally changed iscsi to allocate its own buffers just as an intermediate step to clean up some core buffer allocation mechanisms. Now we can put it back. Also had to change allocate_iovecs to use data_length instead of t_data_nents because iovecs are now allocated before the data buffer, thus t_data_nents is not yet initialized. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Call core_alua_check_nonop_delay in target_submit_cmd()Andy Grover2012-04-141-0/+7
| | | | | | | | | | | | | | | | It appears iscsi is the only one to call this in its cmd submit path, but it appears to be applicable to all fabrics, and should always be called. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Fold _decide_list_to_build into _build_pdu_and_seq_listsAndy Grover2012-04-145-58/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename iscsit_build_pdu_and_seq_list to iscsit_do_build_pdu_and_seq_lists Rename iscsit_do_build_list to iscsit_build_pdu_and_seq_lists Move code from iscsit_decide_list_to_build into _seq_pdu_list.c, seems a better fit. Also update some comments in pdu/seq code for correctness and whitespace. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Eliminate iscsi_cmd.data_lengthAndy Grover2012-04-148-67/+60
| | | | | | | | | | | | | | | | Redundant, just use iscsi_cmd->se_cmd.data_length once se_cmd is initialized, or hdr->data_length before then. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Move init_se_cmd closer to lookup_cmd_lunAndy Grover2012-04-141-11/+11
| | | | | | | | | | | | | | | | | | | | if we can get calls to init_se_cmd, get_sess_cmd, lookup_cmd_lun, core_alua_check_nonop_delay, and handle_cdb_direct next to each other, then we can just call target_submit_cmd. This is a step towards that goal. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Inline iscsit_allocate_se_cmd and *_for_tmrAndy Grover2012-04-143-130/+101
| | | | | | | | | | | | | | | | | | Trying to move a bunch of stuff around so iscsi can use target_submit_cmd someday, and so stuff needs to be in that function directly instead of hidden, so it can be reordered etc. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: rewrite comment for generic_new_cmdAndy Grover2012-04-141-3/+3
| | | | | | | | | | Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Rename target_allocate_tasks to target_setup_cmd_from_cdbAndy Grover2012-04-143-14/+9
| | | | | | | | | | | | | | | | | | | | | | This patch renames a horribly misnamed function that no longer allocate tasks to something more descriptive for it's modern use in target core. (nab: Fix up ib_srpt to use this as well ahead of a target_submit_cmd conversion) Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Misc cleanups from Agrover (round 2)Andy Grover2012-04-1412-109/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch includes the handful of squashed patches for target/iscsi from Andy's original series into lio-core/master code: *) Make iscsit_add_reject static *) Remove unused data_offset_end from iscsi_datain_req *) Remove "#if 0" stubs *) Rename iscsi_datain_req to cmd_datain_node *) Cleanups for built_r2ts_for_cmd() *) Cleanups for Cleanup build_sendtargets_response() Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Refactor target_tx_thread immediate+response queue loopsAndy Grover2012-04-142-244/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Immediate queue: Consolidate down to one switch statement by moving send_tx_data and stuff from second switch into the first switch, or the functions the first switch calls. Response queue: Do not lock istate_lock except directly around i_state modifications. Put entire ISTATE_SEND_DATAIN path within first switch statement, in prep for further refactoring. All other cases set use_misc = 1 and will not be using sendpage, so just use send_tx_data for these and set use_misc param to 1. map_sg, sent_status, use_misc, and se_cmd vars no longer needed. Then put immediate and response handling in separate functions in order to get iscsi_target_tx_thread down to where it fits on a page. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Remove unneeded locking from iscsi_target_tx_threadAndy Grover2012-04-141-10/+2
| | | | | | | | | | | | | | | | | | When processing immediate queue, we're switching on a local variable so it's not necessary to lock around it. However, we are modifying cmd->i_state in two spots, so lock around those parts only. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Misc cleanups from Agrover (round 1)Andy Grover2012-04-143-52/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | *) Use decoded cmd->immediate_cmd for conditional instead of re-examining hdr->opcode *) Make iscist_dataout_post_crc_passed more legible *) use max() to reduce code in build_r2ts_for_cmd() *) Remove CONFIG_SMP and if 0 ifdefs *) Replace if/goto with a while loop *) Remove unused conn->tx_immediate_queue and tx_response_queue Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target/iscsi: Rename iscsi_cmd.i_list to iscsi_cmd.i_conn_nodeAndy Grover2012-04-146-38/+38
| | | | | | | | | | | | | | | | The name change makes it clear this list_head is so the cmd can be an item in the connection's conn_cmd_list. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Remove transport_do_task_sg_chain() and associated detritusRoland Dreier2012-04-141-70/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that all fabrics are converted over to using se_cmd->t_data_sg directly, we can drop the task sg chaining support. With the modern memory allocation in target core, task sg chaining is needless overhead -- we would split up the main cmd sglist into pieces, and then splice those pieces back together instead of just using the original list directly. Signed-off-by: Roland Dreier <roland@purestorage.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * tcm_fc: Remove use of transport_do_task_sg_chain()Roland Dreier2012-04-143-18/+5
| | | | | | | | | | | | | | | | | | | | | | | | With the modern target core, se_cmd->t_data_sg already points to a sglist that covers the whole command. So task_sg chaining is needless overhead and obfuscation -- instead of splicing the split up task sglists back into one list, we can just use the original list directly. Signed-off-by: Roland Dreier <roland@purestorage.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Kiran Patil <Kiran.patil@intel.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: stop splitting commands into multiple tasksChristoph Hellwig2012-04-142-103/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From hch: The high-performance backends (iblock and rd) support tasks of unlimited size. With that there is no reason to keep a complex infrastructure for splitting up commands in place. Stop doing so and only submit a single task per data direction. Once this is in place we can slowly remove fields from the task that duplicate things in the command, or move other fields into the command. From nab: The benefit to IBLOCK performance by removing the additional fast-path allocation overhead + SGL mapping to se_task->task_sg[] is now greater than transparently supporting an received CDB I/O length that exceeds what is allowed by backend pSCSI LLD hardware max_sectors, that was originally supported for all backend export cases. This change may effect some users of pSCSI users on legacy hardware, but I think most folks are now using TYPE_DISK struct scsi_device export with IBLOCK. The only other place where this may can issues that cannot be resolved with IBLOCK TYPE_DISK is using TYPE_ROM, TYPE_TAPE or other pSCSI non TYPE_DISK export with an SCSI LLDs using a smaller max_sectors. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: don't limit transfer sizes for the ramdisk backendChristoph Hellwig2012-04-142-6/+2
| | | | | | | | | | | | | | | | The ramdisk backend has not inherent limitations for handling requests, so don't artificially limits the transfer size. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: misc ramdisk backend cleanupsChristoph Hellwig2012-04-142-125/+41
| | | | | | | | | | | | | | | | Remove various leftovers of the old direct/indirect split, as well as the unused rd_request structure and a couple unused defines and fields. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: add unknown size flag to target_submit_cmd()Sebastian Andrzej Siewior2012-04-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | The UASP protocol does not inform the target device upfront how much data it should expect so we have to learn in from the CDB. So in order to handle this case, add a TARGET_SCF_UNKNOWN_SIZE to target_submit_cmd() and perform an explictly assignment for se_cmd->data_length from the extracted CDB size in transport_generic_cmd_sequencer(). Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Remove obsolete DF_READ_ONLY usageNicholas Bellinger2012-04-142-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This was used at one time as a hack by FILEIO backend registration to allow a struct block_device that was claimed with blkdev_get (by a local filesystem mount for example) to be exported as read-only (SCSI WP=1). Since FILEIO backend registration will no longer attempt to obtain exclusive access to an underlying struct block_device here, this flag is now obsolete. Reported-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* | target: Fix bug in handling of FILEIO + block_device resize opsNicholas Bellinger2012-05-171-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug in the handling of FILEIO w/ underlying block_device resize operations where the original fd_dev->fd_dev_size was incorrectly being used in fd_get_blocks() for READ_CAPACITY response payloads. This patch avoids using fd_dev->fd_dev_size for FILEIO devices with an underlying block_device, and instead changes fd_get_blocks() to get the sector count directly from i_size_read() as recommended by hch. Reported-by: Christoph Hellwig <hch@lst.de> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* | target: Fix SPC-2 RELEASE bug for multi-session iSCSI client setupsBernhard Kohl2012-05-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses a bug in a special case for target core SPC-2 RELEASE logic where the same physical client (eg: iSCSI InitiatorName) with differing iSCSI session identifiers (ISID) is allowed to incorrectly release the same client's SPC-2 reservation from the non reservation holding path. Note this bug is specific to iscsi-target w/ SPC-2 reservations, and with the default enforce_pr_isids=1 device attr setting in target-core controls if a InitiatorName + different ISID reservations are handled the same as a single iSCSI client entity. Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* | target: Drop incorrect se_lun_acl release for dynamic -> explict ACL conversionNicholas Bellinger2012-05-111-22/+0
|/ | | | | | | | | | | | | | | | | This patch removes some potentially problematic legacy code within core_clear_initiator_node_from_tpg() that was originally intended to release left over se_lun_acl setup during dynamic NodeACL+MappedLUN generate when running with TPG demo-mode operation. Since we now only ever expect to allocate and release se_lun_acl from within target_core_fabric_configfs.c:target_fabric_make_mappedlun() and target_fabric_drop_mappedlun() context respectively, this code for demo-mode release is incorrect and needs to be removed. Cc: Christoph Hellwig <hch@lst.de> Cc: Andy Grover <agrover@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* tcm_fc: Do not free tpg structure during wq allocation failureMark Rustad2012-04-061-5/+8
| | | | | | | | | | | Avoid freeing a registered tpg structure if an alloc_workqueue call fails. This fixes a bug where the failure was leaking memory associated with se_portal_group setup during the original core_tpg_register() call. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Acked-by: Kiran Patil <Kiran.patil@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* tcm_fc: Add abort flag for gracefully handling exchange timeoutMark Rustad2012-04-063-2/+11
| | | | | | | | | | | | | | | | | | | Add abort flag and use it to terminate processing when an exchange is timed out or is reset. The abort flag is used in place of the transport_generic_free_cmd function call in the reset and timeout cases, because calling that function in that context would free memory that was in use. The aborted flag allows the lifetime to be managed in a more normal way, while truncating the processing. This change eliminates a source of memory corruption which manifested in a variety of ugly ways. (nab: Drop unused struct fc_exch *ep in ft_recv_seq) Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Acked-by: Kiran Patil <Kiran.patil@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
* Merge branch 'for-next' of ↵Linus Torvalds2012-03-2236-967/+874
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending Pull SCSI target updates from Nicholas Bellinger: "This contains the usual set of updates and bugfixes to target-core + existing fabric module code, along with a handful of the patches destined for v3.3 stable. It also contains the necessary target-core infrastructure pieces required to run using tcm_qla2xxx.ko WWPNs with the new Qlogic Fibre Channel fabric module currently queued in target-pending/for-next-merge, and coming for round 2. The highlights for this series include: - Add target_submit_tmr() helper function for fabric task management (andy) - Convert tcm_fc to use target_submit_tmr() (andy) - Replace target core various cmd flags with a transport state (hch) - Convert loopback to use workqueue submission (hch) - Convert target core to use array_zalloc for tpg_lun_list (joern) - Convert target core to use array_zalloc for device_list (joern) - Add target core support for TMR_ABORT_TASK (nab) - Add target core se_sess->sess_kref + get/put helpers (nab) - Add target core se_node_acl->acl_kref for ->acl_free_comp usage (nab) - Convert iscsi-target to use target_put_session + sess_kref (nab) - Fix tcm_fc fc_exch memory leak in ft_send_resp_status (nab) - Fix ib_srpt srpt_handle_cmd send_ioctx->ioctx_kref leak on exception (nab) - Fix target core up handling of short INQUIRY buffers (roland) - Untangle target-core front-end and back-end meanings of max_sectors attribute (roland) - Set loopback residual field for SCSI commands (roland) - Fix target-core 16-bit target ports for SET TARGET PORT GROUPS emulation (roland) Thanks again to Andy, Christoph, Joern, Roland, and everyone who has contributed this round!" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (64 commits) ib_srpt: Fix srpt_handle_cmd send_ioctx->ioctx_kref leak on exception loopback: Fix transport_generic_allocate_tasks error handling iscsi-target: remove improper externs iscsi-target: Remove unused variables in iscsi_target_parameters.c target: remove obvious warnings target: Use array_zalloc for device_list target: Use array_zalloc for tpg_lun_list target: Fix sense code for unsupported SERVICE ACTION IN target: Remove hack to make READ CAPACITY(10) lie if thin provisioning is enabled target: Bump core version to v4.1.0-rc2-ml + fabric versions tcm_fc: Fix fc_exch memory leak in ft_send_resp_status target: Drop unused legacy target_core_fabric_ops API callers iscsi-target: Convert to use target_put_session + sess_kref target: Convert se_node_acl->acl_group removal to use ->acl_kref target: Add se_node_acl->acl_kref for ->acl_free_comp usage target: Add se_node_acl->acl_free_comp for NodeACL release path target: Add se_sess->sess_kref + get/put helpers target: Convert session_lock to irqsave target: Fix typo in drivers/target iscsi-target: Fix dynamic -> explict NodeACL pointer reference ...
| * loopback: Fix transport_generic_allocate_tasks error handlingNicholas Bellinger2012-03-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses a tcm_loop bug with transport_generic_allocate_tasks() return checking in tcm_loop_submission_work() where other non zero return codes (including -EBUSY for reservation conflicts) are incorrectly falling through to transport_generic_map_mem_to_cmd() -> transport_handle_cdb_direct(). This bug was introduced into target-pending/for-next-merge with the following for-3.4 commit: commit 16786454acec0e0e55e32d508b3058b32c1f23f3 Author: Christoph Hellwig <hch@infradead.org> Date: Thu Feb 2 17:04:42 2012 -0500 tcm_loop: switch to using transport_handle_cdb_direct Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * iscsi-target: remove improper externsDan Carpenter2012-03-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | These externs aren't needed and Sparse complains about them. drivers/target/iscsi/iscsi_target_nodeattrib.c:52:12: warning: function 'iscsit_na_dataout_timeout' with external linkage has definition Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * iscsi-target: Remove unused variables in iscsi_target_parameters.cJörn Engel2012-03-151-10/+9
| | | | | | | | | | | | | | | | local_right_val was an obvious case, tmp_ptr is also write-only, but evades the compiler by being passed to simple_strtoul as char **endp. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: remove obvious warningsJörn Engel2012-03-1510-53/+6
| | | | | | | | | | | | | | | | | | | | | | Get rid of a bunch of write-only variables. In a number of cases I suspect actual bugs to be present, so I left all of those for a second look. (nab: fix lio-core patch fuzz) Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Use array_zalloc for device_listJörn Engel2012-03-156-46/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | Turns an order-8 allocation into slab-sized ones, thereby preventing allocation failures with memory fragmentation. This likely saves memory as well, as the slab allocator can pack objects more tightly than the buddy allocator. (nab: Fix lio-core patch fuzz) Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Use array_zalloc for tpg_lun_listJörn Engel2012-03-152-10/+38
| | | | | | | | | | | | | | | | | | | | | | Turns an order-10 allocation into slab-sized ones, thereby preventing allocation failures with memory fragmentation. This likely saves memory as well, as the slab allocator can pack objects more tightly than the buddy allocator. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Fix sense code for unsupported SERVICE ACTION INRoland Dreier2012-03-151-1/+1
| | | | | | | | | | | | | | | | If we don't handle a given service action, we're supposed to return INVALID FIELD IN CDB, since we do handle the SERVICE ACTION IN opcode. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Remove hack to make READ CAPACITY(10) lie if thin provisioning is ↵Roland Dreier2012-03-151-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enabled Remove the hack that has READ CAPACITY(10) return 0xFFFFFFFF as the number of sectors when thin provisioning is enabled. This is supposed to trigger the initiator to use READ CAPACITY(16) in this case so that it finds out about thin provisioning. But an initiator that cares about thin provisioning is going to ask anyway, and an initiator that doesn't know about READ CAPACITY(16) is going to get the wrong capacity. So just have READ CAPACITY(10) return the size it's supposed to. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Bump core version to v4.1.0-rc2-ml + fabric versionsNicholas Bellinger2012-03-103-3/+3
| | | | | | | | | | | | | | | | | | | | | | Bump core version to v4.1.0-rc2-ml, and for versions from the following mainline fabric modules: loopback: v2.1-rc2 tcm_fc: v0.4 iscsi-target: v4.1.0-rc2 Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * tcm_fc: Fix fc_exch memory leak in ft_send_resp_statusNicholas Bellinger2012-03-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug in tcm_fc where fc_exch memory from fc_exch_mgr->ep_pool is currently being leaked by ft_send_resp_status() usage. Following current code in ft_queue_status() response path, using lport->tt.seq_send() needs to be followed by a lport->tt.exch_done() in order to release fc_exch memory back into libfc_em kmem_cache. ft_send_resp_status() code is currently used in pre submit se_cmd ft_send_work() error exceptions, TM request setup exceptions, and main TM response callback path in ft_queue_tm_resp(). This bugfix addresses the leak in these cases. Cc: Mark D Rustad <mark.d.rustad@intel.com> Cc: Kiran Patil <kiran.patil@intel.com> Cc: Robert Love <robert.w.love@intel.com> Cc: Andy Grover <agrover@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Drop unused legacy target_core_fabric_ops API callersNicholas Bellinger2012-03-107-124/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch drops the following unused legacy API callers from target_core_fabric.h: *) TFO->fall_back_to_erl0() *) TFO->stop_session() *) TFO->sess_logged_in() *) TFO->is_state_remove() This patch also removes the stub usage in loopback, tcm_fc, iscsi_target, and ib_srpt fabric modules. Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * iscsi-target: Convert to use target_put_session + sess_krefNicholas Bellinger2012-03-104-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts iscsi-target session code to use se_sess->sess_kref counting for iscsi session shutdown. The following cases include: *) last iscsit_close_connection() shutdown path to invoke close session *) iscsit_logout_post_handler_closesession() for explict logout *) iscsit_free_session() caller for explict shutdown It also moves iscsit_stop_session() call from lio_tpg_close_session() into lio_tpg_shutdown_session() TFO callbacks to invoke an explict shutdown, and also changes iscsi_check_for_session_reinstatement() login code to use se_sess->sess_kref. (v2: Make iscsit_handle_time2retain_timeout() use target_put_session) Cc: Andy Grover <agrover@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Convert se_node_acl->acl_group removal to use ->acl_krefNicholas Bellinger2012-03-102-19/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts core_tpg_del_initiator_node_acl() shutdown from configfs context to use se_node_acl->acl_kref and ->acl_free_comp in order to wait for outstanding fabric callbacks to complete via transport_deregister_session() callbacks before waking ->acl_free_comp from the last ->acl_kref put. It also changes core_tpg_del_initiator_node_acl() to setup a local sess_list with target_get_session() + acl->acl_stop = 1 for active sessions that will be shutdown, and changes transport_deregister_session_configfs() to check for ->acl_stop usage. Cc: Roland Dreier <roland@purestorage.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Joern Engel <joern@logfs.org> Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Add se_node_acl->acl_kref for ->acl_free_comp usageNicholas Bellinger2012-03-102-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds se_node_acl->acl_kref for use with ->acl_free_comp during explict se_node_acl release. It adds kref_init() during se_node_acl setup, kref_get() during __transport_register_session() -> target_put_nacl() with existing transport_deregister_session() fabric callback usage. It also moves transport_free_session() to release *se_sess memory after target_put_nacl() execution in transport_deregister_session() Cc: Roland Dreier <roland@purestorage.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Joern Engel <joern@logfs.org> Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Add se_node_acl->acl_free_comp for NodeACL release pathNicholas Bellinger2012-03-102-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add se_node_acl->acl_free_comp for NodeACL release path to wait for outstanding fabric session shutdown to complete in transport_deregister_session() before finishing NodeACL release from configfs process context. Also make transport_deregister_session() clear the comp_nacl bit to skip se_node_acl->acl_free_comp completion for dynamically generated NodeACL during fabric session shutdown. Cc: Roland Dreier <roland@purestorage.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Joern Engel <joern@logfs.org> Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Add se_sess->sess_kref + get/put helpersNicholas Bellinger2012-03-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds basic se_session->sess_kref and get/put helpers for fabric session reference counting. It sets the initial kref in transport_init_session() and adds a target_release_session() callback to invoke TFO->close_session() for final session shutdown. Cc: Roland Dreier <roland@purestorage.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Joern Engel <joern@logfs.org> Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Convert session_lock to irqsaveNicholas Bellinger2012-03-102-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the remaining struct se_portal_group->session_lock usage to use irqsave+irqrestore to address the following warnings for hardware target mode interrupt context usage. This change generate other warnings for current iscsi-target mode still using ->session_lock with spin_lock_bh, which will need to be converted in a seperate patch. [ 492.480728] [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ] [ 492.488194] 3.0.0+ #23 [ 492.490820] ------------------------------------------------------ [ 492.497704] sh/7162 [HC0[0]:SC0[2]:HE0:SE0] is trying to acquire: [ 492.504493] (&(&se_tpg->session_lock)->rlock){+.....}, at: [<ffffffffa022364d>] transport_deregister_session+0x2d/0x163 [target_core_mod] 492.518390] [ 492.518390] and this task is already holding: [ 492.524897] (&(&ha->hardware_lock)->rlock){-.-...}, at: [<ffffffffa00b9146>] qla_tgt_stop_phase1+0x5e/0x27e [qla2xxx] [ 492.536856] which would create a new lock dependency: [ 492.542481] (&(&ha->hardware_lock)->rlock){-.-...} -> (&(&se_tpg->session_lock)->rlock){+.....} [ 492.552321] [ 492.552321] but this new dependency connects a HARDIRQ-irq-safe lock: [ 492.561149] (&(&ha->hardware_lock)->rlock){-.-...} [ 492.566400] ... which became HARDIRQ-irq-safe at: [ 492.571841] [<ffffffff81064720>] __lock_acquire+0x68f/0x921 [ 492.578247] [<ffffffff81064eff>] lock_acquire+0xe0/0x10d [ 492.584367] [<ffffffff813a74c6>] _raw_spin_lock_irqsave+0x44/0x56 [ 492.591358] [<ffffffffa009b1be>] qla24xx_msix_default+0x5c/0x2aa [qla2xxx] [ 492.599227] [<ffffffff81088582>] handle_irq_event_percpu+0x5a/0x197 [ 492.606413] [<ffffffff810886fb>] handle_irq_event+0x3c/0x5c [ 492.612822] [<ffffffff8108a6dc>] handle_edge_irq+0xcc/0xf1 [ 492.619138] [<ffffffff810039b9>] handle_irq+0x83/0x8e [ 492.624971] [<ffffffff8100333e>] do_IRQ+0x48/0xaf [ 492.630413] [<ffffffff813a7cd3>] ret_from_intr+0x0/0x1a [ 492.636437] [<ffffffff81001dc1>] cpu_idle+0x5b/0x8d [ 492.642073] [<ffffffff81392709>] rest_init+0xad/0xb4 [ 492.647809] [<ffffffff81a1cbbc>] start_kernel+0x366/0x371 [ 492.654030] [<ffffffff81a1c2b1>] x86_64_start_reservations+0xb8/0xbc [ 492.661311] [<ffffffff81a1c3b6>] x86_64_start_kernel+0x101/0x110 [ 492.668204] [ 492.668205] to a HARDIRQ-irq-unsafe lock: [ 492.674324] (&(&se_tpg->session_lock)->rlock){+.....} [ 492.679862] ... which became HARDIRQ-irq-unsafe at: [ 492.685497] ... [<ffffffff8106479a>] __lock_acquire+0x709/0x921 [ 492.692209] [<ffffffff81064eff>] lock_acquire+0xe0/0x10d [ 492.698330] [<ffffffff813a75ed>] _raw_spin_lock_bh+0x31/0x40 [ 492.704836] [<ffffffffa021c208>] core_tpg_del_initiator_node_acl+0x89/0x336 [target_core_mod] [ 492.714546] [<ffffffffa02fb075>] tcm_qla2xxx_drop_nodeacl+0x20/0x2d [tcm_qla2xxx] [ 492.723087] [<ffffffffa02108d9>] target_fabric_nacl_base_release+0x22/0x24 [target_core_mod] [ 492.732698] [<ffffffffa01661c8>] config_item_release+0x7d/0xa3 [configfs] [ 492.740465] [<ffffffff811d48fe>] kref_put+0x43/0x4d [ 492.746101] [<ffffffffa0166149>] config_item_put+0x19/0x1b [configfs] [ 492.753481] [<ffffffffa0164987>] configfs_rmdir+0x1eb/0x258 [configfs] [ 492.760957] [<ffffffff810ecc54>] vfs_rmdir+0x79/0xd0 [ 492.766690] [<ffffffff810eec4a>] do_rmdir+0xc2/0x111 [ 492.772423] [<ffffffff810eecd0>] sys_rmdir+0x11/0x13 [ 492.778156] [<ffffffff813ae4d2>] system_call_fastpath+0x16/0x1b [ 492.784953] Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * target: Fix typo in drivers/targetMasanari Iida2012-03-102-2/+2
| | | | | | | | | | | | | | | | Correct spelling "exeeds" to "exceeds" in iscsi/iscsi_target_nego.c Correct spelling "diabled" to "disabled" in target_core_configfs.c Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>