31 Jul, 2018
1 commit
-
This just adds a helper function to check if a device is configured and it
converts the target users to use it. The next patch will add a backend
module user so those types of modules do not have to know the lio core
details.Signed-off-by: Mike Christie
Reviewed-by: Xiubo Li
Signed-off-by: Martin K. Petersen
03 Jul, 2018
1 commit
-
Since most target drivers do not use the second fabric_make_tpg() argument
("group") and since it is trivial to derive the group pointer from the wwn
pointer, do not pass the group pointer to fabric_make_tpg().Signed-off-by: Bart Van Assche
Reviewed-by: Mike Christie
Cc: Felipe Balbi
Cc: Hannes Reinecke
Cc: Christoph Hellwig
Signed-off-by: Martin K. Petersen
05 Nov, 2017
1 commit
-
This patch avoids that sparse reports the following warning:
drivers/target/target_core_configfs.c:2267:33: warning: symbol 'target_core_dev_item_ops' was not declared. Should it be static?
Fixes: c17cd24959cd ("target/configfs: Kill se_device->dev_link_magic")
Signed-off-by: Bart Van Assche
Cc: Christoph Hellwig
Cc: Mike Christie
Reviewed-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger
09 Jun, 2017
2 commits
-
Instead of using a hardcoded magic value in se_lun when verifying
a target config_item symlink source during target_fabric_mappedlun_link(),
go ahead and use target_fabric_port_item_ops directly instead.Reviewed-by: Christoph Hellwig
Cc: Mike Christie
Cc: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
Instead of using a hardcoded magic value in se_device when verifying
a target config_item symlink source during target_fabric_port_link(),
go ahead and use target_core_dev_item_ops directly instead.Reviewed-by: Christoph Hellwig
Cc: Mike Christie
Cc: Hannes Reinecke
Signed-off-by: Nicholas Bellinger
30 Mar, 2017
1 commit
-
This patch closes a race between se_lun deletion during configfs
unlink in target_fabric_port_unlink() -> core_dev_del_lun()
-> core_tpg_remove_lun(), when transport_clear_lun_ref() blocks
waiting for percpu_ref RCU grace period to finish, but a new
NodeACL mappedlun is added before the RCU grace period has
completed.This can happen in target_fabric_mappedlun_link() because it
only checks for se_lun->lun_se_dev, which is not cleared until
after transport_clear_lun_ref() percpu_ref RCU grace period
finishes.This bug originally manifested as NULL pointer dereference
OOPsen in target_stat_scsi_att_intr_port_show_attr_dev() on
v4.1.y code, because it dereferences lun->lun_se_dev without
a explicit NULL pointer check.In post v4.1 code with target-core RCU conversion, the code
in target_stat_scsi_att_intr_port_show_attr_dev() no longer
uses se_lun->lun_se_dev, but the same race still exists.To address the bug, go ahead and set se_lun>lun_shutdown as
early as possible in core_tpg_remove_lun(), and ensure new
NodeACL mappedlun creation in target_fabric_mappedlun_link()
fails during se_lun shutdown.Reported-by: James Shen
Cc: James Shen
Tested-by: James Shen
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Nicholas Bellinger
01 Dec, 2016
1 commit
-
Documentation/filesystems/configfs/configfs.txt says:
"When unlink(2) is called on the symbolic link, the source item is
notified via the ->drop_link() method. Like the ->drop_item() method,
this is a void function and cannot return failure."The ->drop_item() is indeed a void function, the ->drop_link() is
actually not. This, together with the fact that the value of ->drop_link()
is silently ignored suggests, that it is the ->drop_link() return
type that should be corrected and changed to void.This patch changes drop_link() signature and all its users.
Signed-off-by: Andrzej Pietrasiewicz
[hch: reverted reformatting of some code]
Signed-off-by: Christoph Hellwig
31 Mar, 2016
3 commits
-
We need to have the WWN fully initialized before addig default groups to it,
so add a new method to add these groups after the WWN has been initialized.
Also remove the default groups in the core while we're at it.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
The iSCSI targets wants to add a default group, for which we need to
have the list of default groups initialized previously.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Instead we can clean up the list of default ACLs in core code.
Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
23 Mar, 2016
1 commit
-
Pull SCSI target updates from Nicholas Bellinger:
"The highlights this round include:- Add target_alloc_session() w/ callback helper for doing se_session
allocation + tag + se_node_acl lookup. (HCH + nab)- Tree-wide fabric driver conversion to use target_alloc_session()
- Convert sbp-target to use percpu_ida tag pre-allocation, and
TARGET_SCF_ACK_KREF I/O krefs (Chris Boot + nab)- Convert usb-gadget to use percpu_ida tag pre-allocation, and
TARGET_SCF_ACK_KREF I/O krefs (Andrzej Pietrasiewicz + nab)- Convert xen-scsiback to use percpu_ida tag pre-allocation, and
TARGET_SCF_ACK_KREF I/O krefs (Juergen Gross + nab)- Convert tcm_fc to use TARGET_SCF_ACK_KREF I/O + TMR krefs
- Convert ib_srpt to use percpu_ida tag pre-allocation
- Add DebugFS node for qla2xxx target sess list (Quinn)
- Rework iser-target connection termination (Jenny + Sagi)
- Convert iser-target to new CQ API (HCH)
- Add pass-through WRITE_SAME support for IBLOCK (Mike Christie)
- Introduce data_bitmap for asynchronous access of data area (Sheng
Yang + Andy)- Fix target_release_cmd_kref shutdown comp leak (Himanshu Madhani)
Also, there is a separate PULL request coming for cxgb4 NIC driver
prerequisites for supporting hw iscsi segmentation offload (ISO), that
will be the base for a number of v4.7 developments involving
iscsi-target hw offloads"* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (36 commits)
target: Fix target_release_cmd_kref shutdown comp leak
target: Avoid DataIN transfers for non-GOOD SAM status
target/user: Report capability of handling out-of-order completions to userspace
target/user: Fix size_t format-spec build warning
target/user: Don't free expired command when time out
target/user: Introduce data_bitmap, replace data_length/data_head/data_tail
target/user: Free data ring in unified function
target/user: Use iovec[] to describe continuous area
target: Remove enum transport_lunflags_table
target/iblock: pass WRITE_SAME to device if possible
iser-target: Kill the ->isert_cmd back pointer in struct iser_tx_desc
iser-target: Kill struct isert_rdma_wr
iser-target: Convert to new CQ API
iser-target: Split and properly type the login buffer
iser-target: Remove ISER_RECV_DATA_SEG_LEN
iser-target: Remove impossible condition from isert_wait_conn
iser-target: Remove redundant wait in release_conn
iser-target: Rework connection termination
iser-target: Separate flows for np listeners and connections cma events
iser-target: Add new state ISER_CONN_BOUND to isert_conn
...
11 Mar, 2016
1 commit
-
se_dev_entry.lun_flags and se_lun.lun_access are only used for keeping
track of read-write vs. read-only state. Since this is an either/or thing
we can represent it as bool, and remove the unneeded enum
transport_lunflags_table, which is left over from when there were more
flags.Change code that uses this enum to just use true/false, and make it clear
through variable and param names that true means read-only, false means
read-write.Signed-off-by: Andy Grover
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
06 Mar, 2016
1 commit
-
Replace the current NULL-terminated array of default groups with a linked
list. This gets rid of lots of nasty code to size and/or dynamically
allocate the array.While we're at it also provide a conveniant helper to remove the default
groups.Signed-off-by: Christoph Hellwig
Acked-by: Felipe Balbi [drivers/usb/gadget]
Acked-by: Joel Becker
Acked-by: Nicholas Bellinger
Reviewed-by: Sagi Grimberg
14 Oct, 2015
1 commit
-
This also allows to remove the target-specific old configfs macros, and
gets rid of the target_core_fabric_configfs.h header which only had one
function declaration left that could be moved to a better place.Signed-off-by: Christoph Hellwig
Reviewed-by: Nicholas Bellinger
Acked-by: Nicholas Bellinger
Signed-off-by: Nicholas Bellinger
31 Jul, 2015
1 commit
-
From: Chris Zankel
The initiatorname field in se_acl_lun is only a copy of the same field
in se_node_acl, so remove it and use the version in se_node_acl where
needed (it's actually only used for pr_debug)Signed-off-by: Chris Zankel
Signed-off-by: Spencer Baugh
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
23 Jun, 2015
1 commit
-
The remaining defintions are private to the target core and can be merged
into target_core_internal.h.Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger
16 Jun, 2015
2 commits
-
LUN allocation is now fully dynamic, so there is no need to
artificially restrain the number of exported LUNs.Signed-off-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
As we're now using a list to hold the LUNs the target core
can now converted to use 64-bit LUNs internally.Signed-off-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger
01 Jun, 2015
3 commits
-
This patch eliminates all se_port + t10_alua_tg_pt_gp_member usage,
and converts current users to direct se_lun pointer dereference.This includes the removal of core_export_port(), core_release_port()
core_dev_export() and core_dev_unexport(). Along with conversion
of special case se_lun pointer dereference within PR ALL_TG_PT=1
and ALUA access state transition UNIT_ATTENTION handling.Also, update core_enable_device_list_for_node() to reference the
new per se_lun->lun_deve_list when creating a new entry, or
replacing an existing one via RCU.Signed-off-by: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
This patch converts the fixed size se_portal_group->tpg_lun_list[]
to use modern RCU with hlist_head in order to support an arbitary
number of se_lun ports per target endpoint.It includes dropping core_tpg_alloc_lun() from core_dev_add_lun(),
and calling it directly from target_fabric_make_lun() to allocate
a new se_lun. And add a new target_fabric_port_release() configfs
item callback to invoke kfree_rcu() to release memory during
se_lun->lun_group shutdown.Also now that se_node_acl->lun_entry_hlist is using RCU, convert
existing tpg_lun_lock to struct mutex so core_tpg_add_node_to_devs()
can perform RCU updater logic without releasing ->tpg_lun_mutex.Also, drop core_tpg_clear_object_luns() and it's single consumer
in iscsi-target, which is duplicating TPG LUN shutdown logic and
is current code results in a NOP.Finally, sbp-target and xen-scsiback fabric driver conversions are
included, which are required due to the non-standard way they use
->tpg_lun_hlist.Reviewed-by: Hannes Reinecke
Cc: Christoph Hellwig
Cc: Sagi Grimberg
Cc: Paul E. McKenney
Cc: Chris Boot
Signed-off-by: Nicholas Bellinger -
This patch converts se_node_acl->device_list[] table for mappedluns
to modern RCU hlist_head usage in order to support an arbitrary number
of node_acl lun mappings.It converts transport_lookup_*_lun() fast-path code to use RCU read path
primitives when looking up se_dev_entry. It adds a new hlist_head at
se_node_acl->lun_entry_hlist for this purpose.For transport_lookup_cmd_lun() code, it works with existing per-cpu
se_lun->lun_ref when associating se_cmd with se_lun + se_device.
Also, go ahead and update core_create_device_list_for_node() +
core_free_device_list_for_node() to use ->lun_entry_hlist.It also converts se_dev_entry->pr_ref_count access to use modern
struct kref counting, and updates core_disable_device_list_for_node()
to kref_put() and block on se_deve->pr_comp waiting for outstanding PR
special-case PR references to drop, then invoke kfree_rcu() to wait
for the RCU grace period to complete before releasing memory.So now that se_node_acl->lun_entry_hlist fast path access uses RCU
protected pointers, go ahead and convert remaining non-fast path
RCU updater code using ->lun_entry_lock to struct mutex to allow
callers to block while walking se_node_acl->lun_entry_hlist.Finally drop the left-over core_clear_initiator_node_from_tpg() that
originally cleared lun_access during se_node_acl shutdown, as post
RCU conversion it now becomes duplicated logic.Reviewed-by: Hannes Reinecke
Cc: Christoph Hellwig
Cc: Sagi Grimberg
Cc: Paul E. McKenney
Signed-off-by: Nicholas Bellinger
31 May, 2015
4 commits
-
It's only embedded into struct target_fabric_configfs these days, so we
might as well remove this layer of abstraction.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Remove all fields that are either unused or can be replaced by trivially
following pointers.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Now that we don't need to set up ->tf_subsys we don't need to copy around
the ops vector anymore.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
By always allocating and adding, respectively removing and freeing
the se_node_acl structure in core code we can remove tons of repeated
code in the init_nodeacl and drop_nodeacl routines. Additionally
this now respects the get_default_queue_depth method in this code
path as well.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
15 Apr, 2015
1 commit
-
Instead of calling target_fabric_configfs_init() +
target_fabric_configfs_register() / target_fabric_configfs_deregister()
target_fabric_configfs_free() from every target driver, rewrite the API
so that we have simple register/unregister functions that operate on
a const operations vector.This patch also fixes a memory leak in several target drivers. Several
target drivers namely called target_fabric_configfs_deregister()
without calling target_fabric_configfs_free().A large part of this patch is based on earlier changes from
Bart Van Assche .(v2: Add a new TF_CIT_SETUP_DRV macro so that the core configfs code
can declare attributes as either core only or for drivers)Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
02 Oct, 2014
1 commit
-
Remove core_tpg_pre_dellun entirely, since we don't need to get/check
a pointer we already have.Nothing else can return an error, so core_dev_del_lun can return void.
Rename core_tpg_post_dellun to remove_lun - a clearer name, now that
pre_dellun is gone.Reviewed-by: Christoph Hellwig
Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger
18 Sep, 2014
2 commits
-
Coverity complained that lun_cg has been dereferenced in all paths
leading to NULL check. It didn't mention that only a single path could
lead there and the code can be simplified even further.Signed-off-by: Joern Engel
Signed-off-by: Nicholas Bellinger -
This patch fixes a memory leak on error in target_fabric_make_mappedlun(),
where se_lun_acl memory does not get released on exit.Found by coverity.
Signed-off-by: Joern Engel
Signed-off-by: Nicholas Bellinger
16 Sep, 2014
1 commit
-
This patch removes the null test on lun_cg. lun_cg is initialized
at the beginning of the function to &lun->lun_group. Since lun_cg is
dereferenced prior to the null test, it must be a valid pointer.The following Coccinelle script is used for detecting the change:
@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@*e = &f->g
y
...+>
*if (e != NULL || ...)
S1 else S2Signed-off-by: Himangi Saraogi
Acked-by: Julia Lawall
Signed-off-by: Nicholas Bellinger
17 Dec, 2013
2 commits
-
Allocating an array of pointers, not the objects themselves. These two
sites now match all the other sites.Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
See target_stat_setup_port_default_groups, we need a 4 element array.
Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger
17 Oct, 2013
1 commit
-
Remove a lingering macro that just hid a dereference.
Reviewed-by: Christoph Hellwig
Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger
11 Sep, 2013
1 commit
-
Update copyright ownership/year information for target-core,
loopback, iscsi-target, tcm_qla2xx, vhost and iser-target.Signed-off-by: Nicholas Bellinger
13 Aug, 2013
1 commit
-
The usage of strict_strtoul() and strict_strtoull() is not preferred,
because strict_strtoul() and strict_strtoull() are obsolete. Thus,
kstrtoul() and kstrtoull() should be used.v2: Fix incorrect return in ft_add_tpg (Fengguang)
Signed-off-by: Jingoo Han
Signed-off-by: Nicholas Bellinger
04 Jul, 2013
1 commit
-
This patch adds an optional /auth/ configfs group to TPG context that
can be used by fabrics like iscsi-target for TPG demo-mode
authentication.Cc: Dax Kelson
Signed-off-by: Nicholas Bellinger
19 Feb, 2013
2 commits
-
This patch adds missing bounds checking for the configfs provided
mapped_lun value during target_fabric_make_mappedlun() setup ahead
of se_lun_acl initialization.This addresses a potential OOPs when using a mapped_lun value that
exceeds the hardcoded TRANSPORT_MAX_LUNS_PER_TPG-1 value within
se_node_acl->device_list[].Reported-by: Jan Engelhardt
Cc: Jan Engelhardt
Cc:
Signed-off-by: Nicholas Bellinger -
This patch fixes a bug in core_tpg_check_initiator_node_acl() ->
core_tpg_get_initiator_node_acl() where a dynamically created
se_node_acl generated during session login would be skipped during
subsequent lookup due to the '!acl->dynamic_node_acl' check, causing
a new se_node_acl to be created with a duplicate ->initiatorname.This would occur when a fabric endpoint was configured with
TFO->tpg_check_demo_mode()=1 + TPF->tpg_check_demo_mode_cache()=1
preventing the release of an existing se_node_acl during se_session
shutdown.Also, drop the unnecessary usage of core_tpg_get_initiator_node_acl()
within core_dev_init_initiator_node_lun_acl() that originally
required the extra '!acl->dynamic_node_acl' check, and just pass
the configfs provided se_node_acl pointer instead.Cc:
Signed-off-by: Nicholas Bellinger
01 Feb, 2013
1 commit
-
This patch fixes a v3.8-rc1 regression bug where an unconfigured se_device
was incorrectly allowed to perform a fabric port-link. This bug was
introduced in commit:commit 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16
Author: Christoph Hellwig
Date: Mon Oct 8 00:03:19 2012 -0400target: kill struct se_subsystem_dev
which ended up dropping the original se_subsystem_dev->se_dev_ptr check
preventing this from happening with pre commit 0fd97ccf code.Cc: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
05 Dec, 2012
1 commit
-
This patch adds [dev,lun]_link_magic value assignment + checks within generic
target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure
destination config_item *target_item sent from configfs_symlink() ->
config_item_operations->allow_link() is the underlying se_device->dev_group
and se_lun->lun_group that we expect to symlink.Reported-by: Sebastian Andrzej Siewior
Cc: Sebastian Andrzej Siewior
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger