aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-04-14target: Rename target_allocate_tasks to target_setup_cmd_from_cdbAndy Grover1-7/+2
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>
2012-04-14target/iscsi: Misc cleanups from Agrover (round 2)Andy Grover9-74/+59
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>
2012-04-14target/iscsi: Refactor target_tx_thread immediate+response queue loopsAndy Grover2-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>
2012-04-14target/iscsi: Remove unneeded locking from iscsi_target_tx_threadAndy Grover1-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>
2012-04-14target/iscsi: Misc cleanups from Agrover (round 1)Andy Grover3-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>
2012-04-14target/iscsi: Rename iscsi_cmd.i_list to iscsi_cmd.i_conn_nodeAndy Grover6-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>
2012-03-22Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pendingLinus Torvalds14-145/+50
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 ...
2012-03-21Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-securityLinus Torvalds2-0/+2
Pull security subsystem updates for 3.4 from James Morris: "The main addition here is the new Yama security module from Kees Cook, which was discussed at the Linux Security Summit last year. Its purpose is to collect miscellaneous DAC security enhancements in one place. This also marks a departure in policy for LSM modules, which were previously limited to being standalone access control systems. Chromium OS is using Yama, and I believe there are plans for Ubuntu, at least. This patchset also includes maintenance updates for AppArmor, TOMOYO and others." Fix trivial conflict in <net/sock.h> due to the jumo_label->static_key rename. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (38 commits) AppArmor: Fix location of const qualifier on generated string tables TOMOYO: Return error if fails to delete a domain AppArmor: add const qualifiers to string arrays AppArmor: Add ability to load extended policy TOMOYO: Return appropriate value to poll(). AppArmor: Move path failure information into aa_get_name and rename AppArmor: Update dfa matching routines. AppArmor: Minor cleanup of d_namespace_path to consolidate error handling AppArmor: Retrieve the dentry_path for error reporting when path lookup fails AppArmor: Add const qualifiers to generated string tables AppArmor: Fix oops in policy unpack auditing AppArmor: Fix error returned when a path lookup is disconnected KEYS: testing wrong bit for KEY_FLAG_REVOKED TOMOYO: Fix mount flags checking order. security: fix ima kconfig warning AppArmor: Fix the error case for chroot relative path name lookup AppArmor: fix mapping of META_READ to audit and quiet flags AppArmor: Fix underflow in xindex calculation AppArmor: Fix dropping of allowed operations that are force audited AppArmor: Add mising end of structure test to caps unpacking ...
2012-03-17iscsi-target: remove improper externsDan Carpenter1-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>
2012-03-15iscsi-target: Remove unused variables in iscsi_target_parameters.cJörn Engel1-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>
2012-03-15target: remove obvious warningsJörn Engel3-21/+2
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>
2012-03-13iscsi-target: Fix reservation conflict -EBUSY response handling bugNicholas Bellinger1-1/+1
This patch addresses a iscsi-target specific bug related to reservation conflict handling in iscsit_handle_scsi_cmd() that has been causing reservation conflicts to complete and not fail as expected due to incorrect errno checking. The problem occured with the change to return -EBUSY from transport_generic_cmd_sequencer() -> transport_generic_allocate_tasks() failures, that broke iscsit_handle_scsi_cmd() checking for -EINVAL in order to invoke a non GOOD status response. This was manifesting itself as data corruption with legacy SPC-2 reservations, but also effects iscsi-target LUNs with SPC-3 persistent reservations. This bug was originally introduced in lio-core commit: commit 03e98c9eb916f3f0868c1dc344dde2a60287ff72 Author: Nicholas Bellinger <nab@linux-iscsi.org> Date: Fri Nov 4 02:36:16 2011 -0700 target: Address legacy PYX_TRANSPORT_* return code breakage Reported-by: Martin Svec <martin.svec@zoner.cz> Cc: Martin Svec <martin.svec@zoner.cz> Cc: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-03-10target: Bump core version to v4.1.0-rc2-ml + fabric versionsNicholas Bellinger1-1/+1
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>
2012-03-10target: Drop unused legacy target_core_fabric_ops API callersNicholas Bellinger1-43/+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>
2012-03-10iscsi-target: Convert to use target_put_session + sess_krefNicholas Bellinger4-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>
2012-03-10target: Fix typo in drivers/targetMasanari Iida1-1/+1
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>
2012-03-08iscsi-target: Fix dynamic -> explict NodeACL pointer referenceNicholas Bellinger1-4/+2
This patch fixes a free after use in lio_target_make_nodeacl() where iscsi_node_acl was referenced from the original se_nacl_new allocation, instead of from core_tpg_add_initiator_node_acl() in the case of dynamic -> explict NodeACL conversion. Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-25iscsi-target: Fix iscsit_alloc_buffs() failure casesNicholas Bellinger1-8/+6
Make iscsit_alloc_buffs() failure case for page_alloc_failed use correct __free_page() SGL pointer, and return -ENOMEM for iscsit_allocate_iovecs failure to push se_cmd->t_mem_sg release into iscsit_release_cmd() callback during iscsit_add_reject_from_cmd() connection reset. Also drop cmd->t_mem_sg = NULL assignment from page_alloc_failed failure case. Reported-by: Roland Dreier <roland@purestorage.com> Cc: Andy Grover <agrover@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-25target: Add SCF_SCSI_TMR_CDB usage and drop se_tmr_req_cacheAndy Grover1-4/+3
Change the test for if a cmd is a tmr request to checking if SCF_SCSI_TMR_CDB (a new flag) is set in cmd->se_cmd_flags. Also remove se_tmr_req_cache usage in favor of kzalloc usage, and make core_tmr_alloc_req() return int + setup se_cmd->se_tmr_req directly and fix up various fabric module usages Cc: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-25target/iscsi: Remove unneeded wrapper functionsAndy Grover3-25/+4
iscsit_get_lun_for_{cmd,tmr} are unnecessary. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-25target: Use LIST_HEAD()/DEFINE_MUTEX() for static objectsRoland Dreier1-6/+0
Instead of static struct list_head foo; static struct mutex bar; ... INIT_LIST_HEAD(&foo); mutex_init(&bar); just do static LIST_HEAD(foo); static DEFINE_MUTEX(bar); Also remove some superfluous struct list_head and spinlock_t initialization calls where the variables are already defined using macros that initialize them. This saves a decent amount of compiled code too: add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-178 (-178) function old new delta target_core_init_configfs 898 850 -48 core_scsi3_emulate_pro_preempt 1742 1683 -59 iscsi_thread_set_init 159 88 -71 Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-25target: replace various cmd flags with a transport stateChristoph Hellwig3-5/+5
Replace various atomic_ts used as flags in struct se_cmd with a single transport_state bitmap that requires t_state_lock to be held for modifications. In the target core that assumption generally is true, but some recently added code in the SRP target had to grow new lock calls. I can't say I like the way how it messes with the command state directly, but let's leave that for later. (Re-add missing ib_srpt.c changes that nab dropped..) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-14security: trim security.hAl Viro2-0/+2
Trim security.h Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: James Morris <jmorris@namei.org>
2012-02-07iscsi: use IP_FREEBIND socket optionDax Kelson1-0/+8
Use IP_FREEBIND socket option so that iscsi portal configuration with explicit IP addresses can happen during boot, before network interfaces have been assigned IPs. This is especially important on systemd based Linux boxes where system boot happens asynchronously and non-trivial configuration must be done to get targetcli.service to start synchronously after the network is configured. Reference: http://lists.fedoraproject.org/pipermail/devel/2011-October/158025.html Signed-off-by: Dax Kelson <dkelson@gurulabs.com> Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org> Cc: "Andy Grover" <agrover@redhat.com> Cc: "Lennart Poettering" <lennart@poettering.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-02-07iscsi_target: in_aton needs linux/inet.hStephen Rothwell1-0/+1
Fixes this error after a recent nfs cleanup: drivers/target/iscsi/iscsi_target_configfs.c: In function 'lio_target_call_addnptotpg': drivers/target/iscsi/iscsi_target_configfs.c:214:3: error: implicit declaration of function 'in6_pton' [-Werror=implicit-function-declaration] drivers/target/iscsi/iscsi_target_configfs.c:239:3: error: implicit declaration of function 'in_aton' [-Werror=implicit-function-declaration] Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-01-18iscsi-target: Fix discovery with INADDR_ANY and IN6ADDR_ANY_INITNicholas Bellinger3-8/+62
This patch addresses a bug with sendtargets discovery where INADDR_ANY (0.0.0.0) + IN6ADDR_ANY_INIT ([0:0:0:0:0:0:0:0]) network portals where incorrectly being reported back to initiators instead of the address of the connecting interface. To address this, save local socket ->getname() output during iscsi login setup, and makes iscsit_build_sendtargets_response() return these TargetAddress keys when INADDR_ANY or IN6ADDR_ANY_INIT portals are in use. Reported-by: Dax Kelson <dkelson@gurulabs.com> Reported-by: Andy Grover <agrover@redhat.com> Cc: David S. Miller <davem@davemloft.net> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-01-18iscsi-target: Fix up a few assignmentsJesper Juhl1-2/+2
A statement such as struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess); has undefined behaviour since there are two assignments to 'na', strictly speaking (the order in which side-effects from the assignments take place is undefined since there's no intervening sequence point), and it looks unintentional in any case. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-01-18iscsi-target: make one-bit bitfields unsignedDan Carpenter1-2/+2
Signed bitfields are a problem because instead of being 1 or 0 like you'd expect they are 0 and -1. It doesn't cause a problem in this case but sparse complains: drivers/target/iscsi/iscsi_target_core.h:564:56: error: dubious one-bit signed bitfield Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-01-18iscsi-target: Fix double list_add with iscsit_alloc_buffs rejectNicholas Bellinger1-1/+1
This patch fixes a bug where the iscsit_add_reject_from_cmd() call from a failure to iscsit_alloc_buffs() was incorrectly passing add_to_conn=1 and causing a double list_add after iscsi_cmd->i_list had already been added in iscsit_handle_scsi_cmd(). Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-01-18iscsi-target: Fix reject release handling in iscsit_free_cmd()Nicholas Bellinger1-0/+11
This patch addresses a bug where iscsit_free_cmd() was incorrectly calling iscsit_release_cmd() for ISCSI_OP_REJECT because iscsi_add_reject*() will overwrite the original iscsi_cmd->iscsi_opcode assignment. This bug was introduced with the following commit: commit 0be67f2ed8f577d2c72d917928394c5885fa9134 Author: Nicholas Bellinger <nab@linux-iscsi.org> Date: Sun Oct 9 01:48:14 2011 -0700 iscsi-target: Remove SCF_SE_LUN_CMD flag abuses and was manifesting itself as list corruption with the following: [ 131.191092] ------------[ cut here ]------------ [ 131.191092] WARNING: at lib/list_debug.c:53 __list_del_entry+0x8d/0x98() [ 131.191092] Hardware name: VMware Virtual Platform [ 131.191092] list_del corruption. prev->next should be ffff880022d3c100, but was 6b6b6b6b6b6b6b6b [ 131.191092] Modules linked in: tcm_vhost ib_srpt ib_cm ib_sa ib_mad ib_core tcm_qla2xxx qla2xxx tcm_loop tcm_fc libfc scsi_transport_fc crc32c iscsi_target_mod target_core_stgt scsi_tgt target_core_pscsi target_core_file target_core_iblock target_core_mod configfs ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi sr_mod cdrom sd_mod e1000 ata_piix libata mptspi mptscsih mptbase [last unloaded: scsi_wait_scan] [ 131.191092] Pid: 2250, comm: iscsi_ttx Tainted: G W 3.2.0-rc4+ #42 [ 131.191092] Call Trace: [ 131.191092] [<ffffffff8103b553>] warn_slowpath_common+0x80/0x98 [ 131.191092] [<ffffffff8103b5ff>] warn_slowpath_fmt+0x41/0x43 [ 131.191092] [<ffffffff811d0279>] __list_del_entry+0x8d/0x98 [ 131.191092] [<ffffffffa01395c9>] transport_lun_remove_cmd+0x9b/0xb7 [target_core_mod] [ 131.191092] [<ffffffffa013a55c>] transport_generic_free_cmd+0x5d/0x71 [target_core_mod] [ 131.191092] [<ffffffffa01a012b>] iscsit_free_cmd+0x1e/0x27 [iscsi_target_mod] [ 131.191092] [<ffffffffa01a13be>] iscsit_close_connection+0x14d/0x5b2 [iscsi_target_mod] [ 131.191092] [<ffffffffa0196a0c>] iscsit_take_action_for_connection_exit+0xdb/0xe0 [iscsi_target_mod] [ 131.191092] [<ffffffffa01a55d4>] iscsi_target_tx_thread+0x15cb/0x1608 [iscsi_target_mod] [ 131.191092] [<ffffffff8103609a>] ? check_preempt_wakeup+0x121/0x185 [ 131.191092] [<ffffffff81030801>] ? __dequeue_entity+0x2e/0x33 [ 131.191092] [<ffffffffa01a4009>] ? iscsit_send_text_rsp+0x25f/0x25f [iscsi_target_mod] [ 131.191092] [<ffffffffa01a4009>] ? iscsit_send_text_rsp+0x25f/0x25f [iscsi_target_mod] [ 131.191092] [<ffffffff8138f706>] ? schedule+0x55/0x57 [ 131.191092] [<ffffffff81056c7d>] kthread+0x7d/0x85 [ 131.191092] [<ffffffff81399534>] kernel_thread_helper+0x4/0x10 [ 131.191092] [<ffffffff81056c00>] ? kthread_worker_fn+0x16d/0x16d [ 131.191092] [<ffffffff81399530>] ? gs_change+0x13/0x13 Reported-by: <jrepac@yahoo.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-14iscsi-target: fix chap identifier simple_strtoul usageNicholas Bellinger1-3/+7
This patch makes chap_server_compute_md5() use proper unsigned long usage for the CHAP_I (identifier) and check for values beyond 255 as per RFC-1994. Reported-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-14target: remove useless castsJörn Engel9-48/+48
A reader should spend an extra moment whenever noticing a cast, because either something special is going on that deserves extra attention or, as is all too often the case, the code is wrong. These casts, afaics, have all been useless. They cast a foo* to a foo*, cast a void* to the assigned type, cast a foo* to void*, before assigning it to a void* variable, etc. In a few cases I also removed an additional &...[0], which is equally useless. Lastly I added three FIXMEs where, to the best of my judgement, the code appears to have a bug. It would be good if someone could check these. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-14target: header reshuffle, part2Christoph Hellwig13-23/+11
This reorganized the headers under include/target into: - target_core_base.h stays as is with all target-wide data stuctures and defines - target_core_backend.h contains the whole interface to I/O backends - target_core_fabric.h contains the whole interface to fabric modules Except for those only the various configfs macro headers stay around. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06iscsi-target: Fix hex2bin warn_unused compile messageNicholas Bellinger1-2/+4
Fix the following compile warning with hex2bin() usage: drivers/target/iscsi/iscsi_target_auth.c: In function ‘chap_string_to_hex’: drivers/target/iscsi/iscsi_target_auth.c:35: warning: ignoring return value of ‘hex2bin’, declared with attribute warn_unused_result Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06target: remove unused struct fieldsJörn Engel1-2/+0
Some are never used, some are set but never read, dev_hoq_count is incremented and decremented, but never read. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06iscsi-target: Use kmemdup rather than duplicating its implementationThomas Meyer2-6/+3
The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06iscsi-target: Add missing F_BIT for iscsi_tm_rspNicholas Bellinger1-0/+1
This patch sets the missing ISCSI_FLAG_CMD_FINAL bit in iscsit_send_task_mgt_rsp() for a struct iscsi_tm_rsp PDU. This usage is hardcoded for all TM response PDUs in RFC-3720 section 10.6. Reported-by: whucecil <whucecil1999@gmail.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06iscsi-target: Fix residual count hanlding + remove iscsi_cmd->residual_countNicholas Bellinger2-5/+6
This patch fixes iscsi-target handling of underflow where residual data is causing an OOPs by using the incorrect iscsi_cmd_t->data_length initially assigned in iscsit_allocate_se_cmd(). It resets iscsi_cmd_t->data_length from se_cmd_t->data_length after transport_generic_allocate_tasks() has been invoked in iscsit_handle_scsi_cmd() RX context, and converts iscsi_cmd->residual_count usage to access iscsi_cmd->se_cmd.residual_count to get the proper residual count set by target-core. Reported-by: <lists@internyc.net> Cc: Christoph Hellwig <hch@lst.de> Cc: Andy Grover <agrover@redhat.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06iscsi-target: Fix sess allocation leak in iscsi_login_zero_tsih_s1Nicholas Bellinger1-5/+8
This patch adds missing kfree() for an allocation in iscsi_login_zero_tsih_s1() code, and make transport_init_session() check for IS_ERR() returns. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-12-06target: Address legacy PYX_TRANSPORT_* return code breakageNicholas Bellinger2-9/+3
This patch removes legacy usage of PYX_TRANSPORT_* return codes in a number of locations and addresses cases where transport_generic_request_failure() was returning the incorrect sense upon CHECK_CONDITION status after the v3.1 converson to use errno return codes. This includes the conversion of transport_generic_request_failure() to process cmd->scsi_sense_reason and handle extra TCM_RESERVATION_CONFLICT before calling transport_send_check_condition_and_sense() to queue up response status. It also drops PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES legacy usgae, and returns TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE w/ a response for these cases. transport_generic_allocate_tasks(), transport_generic_new_cmd(), backend SCF_SCSI_DATA_SG_IO_CDB ->do_task(), and emulated ->execute_task() have all been updated to set se_cmd->scsi_sense_reason and return errno codes universally upon failure. This includes cmd->scsi_sense_reason assignment in target_core_alua.c, target_core_pr.c and target_core_cdb.c emulation code. Finally it updates fabric modules to remove the legacy usage, and for TFO->new_cmd_map() callers forwards return values outside of fabric code. iscsi-target has also been updated to remove a handful of special cases related to the cleanup and signaling QUEUE_FULL handling w/ ft_write_pending() (v2: Drop extra SCF_SCSI_CDB_EXCEPTION check during failure from transport_generic_new_cmd, and re-add missing task->task_error_status assignment in transport_complete_task) Cc: Christoph Hellwig <hch@lst.de> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-11-06Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linuxLinus Torvalds3-0/+3
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
2011-11-06Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pendingLinus Torvalds1-5/+6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: target: use ->exectute_task for all CDB emulation target: remove SCF_EMULATE_CDB_ASYNC target: refactor transport_emulate_control_cdb target: pass the se_task to the CDB emulation callback target: split core_scsi3_emulate_pr target: split core_scsi2_emulate_crh target: Add generic active I/O shutdown logic target: add back error handling in transport_complete_task target/pscsi: blk_make_request() returns an ERR_PTR() target: Remove core TRANSPORT_FREE_CMD_INTR usage target: Make TFO->check_stop_free return free status iscsi-target: Fix non-immediate TMR handling iscsi-target: Add missing CMDSN_LOWER_THAN_EXP check in iscsit_handle_scsi_cmd target: Avoid double list_del for aborted se_tmr_req target: Minor cleanups to core_tmr_drain_tmr_list target: Fix wrong se_tmr being added to drain_tmr_list target: Fix incorrect se_cmd assignment in core_tmr_drain_tmr_list target: Check -ENOMEM to signal QUEUE_FULL from fabric callbacks tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB target: Fix compile warning w/ missing module.h include
2011-11-02iscsi-target: Fix non-immediate TMR handlingNicholas Bellinger1-4/+3
This patch addresses two issues with non immediate TMR handling in iscsit_handle_task_mgt_cmd(). The first involves breakage due to v3.1-rc conversion of iscsit_sequence_cmd(), which upon good status would hit the iscsit_add_reject_from_cmd() block of code. This patch adds an explict check for CMDSN_ERROR_CANNOT_RECOVER. The second adds a check to return when non immediate TMR operation is detected after iscsit_ack_from_expstatsn(), as iscsit_sequence_cmd() -> iscsit_execute_cmd() will have called transport_generic_handle_tmr() for the non immediate TMR case already. Cc: Andy Grover <agrover@redhat.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-11-02iscsi-target: Add missing CMDSN_LOWER_THAN_EXP check in iscsit_handle_scsi_cmdNicholas Bellinger1-1/+3
This patch adds a missing CMDSN_LOWER_THAN_EXP return check for iscsit_sequence_cmd() in iscsit_handle_scsi_cmd() that was incorrectly dropped during the v3.1-rc cleanups to use iscsit_sequence_cmd(). Cc: Andy Grover <agrover@redhat.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-10-31drivers/target: Add module.h to drivers/target files as required.Paul Gortmaker1-0/+1
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31drivers/target: Add export.h to files as required.Paul Gortmaker2-0/+2
So that they have access to EXPORT_SYMBOL variants and THIS_MODULE. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-25Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivialLinus Torvalds1-1/+1
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (59 commits) MAINTAINERS: linux-m32r is moderated for non-subscribers linux@lists.openrisc.net is moderated for non-subscribers Drop default from "DM365 codec select" choice parisc: Kconfig: cleanup Kernel page size default Kconfig: remove redundant CONFIG_ prefix on two symbols cris: remove arch/cris/arch-v32/lib/nand_init.S microblaze: add missing CONFIG_ prefixes h8300: drop puzzling Kconfig dependencies MAINTAINERS: microblaze-uclinux@itee.uq.edu.au is moderated for non-subscribers tty: drop superfluous dependency in Kconfig ARM: mxc: fix Kconfig typo 'i.MX51' Fix file references in Kconfig files aic7xxx: fix Kconfig references to READMEs Fix file references in drivers/ide/ thinkpad_acpi: Fix printk typo 'bluestooth' bcmring: drop commented out line in Kconfig btmrvl_sdio: fix typo 'btmrvl_sdio_sd6888' doc: raw1394: Trivial typo fix CIFS: Don't free volume_info->UNC until we are entirely done with it. treewide: Correct spelling of successfully in comments ...
2011-10-24target: Fix incorrect transport_sent usageNicholas Bellinger2-3/+2
This patch converts target-core to use se_cmd->t_transport_sent instead of a duplicated se_cmd->transport_sent member in a handful of locations. It also updates iscsi_target to properly use ->t_transport_sent instead of it's own iscsi_cmd_t->transport_sent value that was not being assigned. Reported-by: Christoph Hellwig <hch@lst.de> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-10-24target: Cleanup unused target_core_base.h bitsChristoph Hellwig2-1/+4
This is a squashed version of the following target_core_base.h cleanup patches: target: remove the unused SHUTDOWN_SIGS defintion target: remove unused se_mem leftovers target: remove the unused map_func_t typedef target: move TRANSPORT_IOV_DATA_BUFFER to the iscsi-specific code Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2011-10-24iscsi-target: Remove SCF_SE_LUN_CMD flag abusesNicholas Bellinger4-56/+28
This patch removes a number of SCF_SE_LUN_CMD flag abuses within iscsi-target code to determine when iscsit_release_cmd() or transport_generic_free_cmd() should be called while releasing an individual iscsi_cmd descriptor. In the place of SCF_SE_LUN_CMD checks, this patch converts existing code to use a new iscsit_free_cmd() that inspects iscsi_cmd->iscsi_opcode types to determine which of the above functions should be invoked. It also removes the now unnecessary special case checking in iscsit_release_commands_from_conn(). (hch: Use iscsit_free_cmd instead of open-coded alternative) Reported-by: Christoph Hellwig <hch@lst.de> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>