12 Sep, 2015
1 commit
-
Pull SCSI target updates from Nicholas Bellinger:
"Here are the outstanding target-pending updates for v4.3-rc1.Mostly bug-fixes and minor changes this round. The fallout from the
big v4.2-rc1 RCU conversion have (thus far) been minimal.The highlights this round include:
- Move sense handling routines into scsi_common code (Sagi)
- Return ABORTED_COMMAND sense key for PI errors (Sagi)
- Add tpg_enabled_sendtargets attribute for disabled iscsi-target
discovery (David)- Shrink target struct se_cmd by rearranging fields (Roland)
- Drop iSCSI use of mutex around max_cmd_sn increment (Roland)
- Replace iSCSI __kernel_sockaddr_storage with sockaddr_storage (Andy +
Chris)- Honor fabric max_data_sg_nents I/O transfer limit (Arun + Himanshu +
nab)- Fix EXTENDED_COPY >= v4.1 regression OOPsen (Alex + nab)"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (37 commits)
target: use stringify.h instead of own definition
target/user: Fix UFLAG_UNKNOWN_OP handling
target: Remove no-op conditional
target/user: Remove unused variable
target: Fix max_cmd_sn increment w/o cmdsn mutex regressions
target: Attach EXTENDED_COPY local I/O descriptors to xcopy_pt_sess
target/qla2xxx: Honor max_data_sg_nents I/O transfer limit
target/iscsi: Replace __kernel_sockaddr_storage with sockaddr_storage
target/iscsi: Replace conn->login_ip with login_sockaddr
target/iscsi: Keep local_ip as the actual sockaddr
target/iscsi: Fix np_ip bracket issue by removing np_ip
target: Drop iSCSI use of mutex around max_cmd_sn increment
qla2xxx: Update tcm_qla2xxx module description to 24xx+
iscsi-target: Add tpg_enabled_sendtargets for disabled discovery
drivers: target: Drop unlikely before IS_ERR(_OR_NULL)
target: check DPO/FUA usage for COMPARE AND WRITE
target: Shrink struct se_cmd by rearranging fields
target: Remove cmd->se_ordered_id (unused except debug log lines)
target: add support for START_STOP_UNIT SCSI opcode
target: improve unsupported opcode message
...
11 Sep, 2015
1 commit
-
This patch adds an optional fabric driver provided SGL limit
that target-core will honor as it's own internal I/O maximum
transfer length limit, as exposed by EVPD=0xb0 block limits
parameters.This is required for handling cases when host I/O transfer
length exceeds the requested EVPD block limits maximum
transfer length. The initial user of this logic is qla2xxx,
so that we can avoid having to reject I/Os from some legacy
FC hosts where EVPD=0xb0 parameters are not honored.When se_cmd payload length exceeds the provided limit in
target_check_max_data_sg_nents() code, se_cmd->data_length +
se_cmd->prot_length are reset with se_cmd->residual_count
plus underflow bit for outgoing TFO response callbacks.
It also checks for existing CDB level underflow + overflow
and recalculates final residual_count as necessary.Note this patch currently assumes 1:1 mapping of PAGE_SIZE
per struct scatterlist entry.Reported-by: Craig Watson
Cc: Craig Watson
Tested-by: Himanshu Madhani
Cc: Roland Dreier
Cc: Arun Easi
Cc: Giridhar Malavali
Cc: Andrew Vasquez
Cc: Christoph Hellwig
Cc: Hannes Reinecke
Cc: Martin K. Petersen
Signed-off-by: Nicholas Bellinger
27 Aug, 2015
4 commits
-
It appears to be what the rest of the kernel does, so let's do it too.
Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Very similar to how it went with local_sockaddr.
It was embedded in iscsi_login_stats so some changes there, and we needed
to copy in a sockaddr_storage comparison function. Hopefully the kernel
will get a standard one soon, our implementation makes the 3rd.isert_set_conn_info() became much smaller.
IPV6_ADDRESS_SPACE define goes away, had to modify a call to in6_pton(),
can just use -1 since we are sure string is null-terminated.Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
This is a more natural format that lets us format it with the appropriate
printk specifier as needed.This also lets us handle v4-mapped ipv6 addresses a little more nicely, by
storing the addr as an actual v4 sockaddr in conn->local_sockaddr.Finally, we no longer need to maintain variables for port, since this is
contained in sockaddr. Remove iscsi_np.np_port and iscsi_conn.local_port.Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Revert commit 1997e6259, which causes double brackets on ipv6
inaddr_any addresses.Since we have np_sockaddr, if we need a textual representation we can
use "%pISc".Change iscsit_add_network_portal() and iscsit_add_np() signatures to remove
*ip_str parameter.Fix and extend some comments earlier in the function.
Tested to work for :: and ::1 via iscsiadm, previously :: failed, see
https://bugzilla.redhat.com/show_bug.cgi?id=1249107 .CC: stable@vger.kernel.org
Signed-off-by: Andy Grover
Signed-off-by: Nicholas Bellinger
03 Aug, 2015
2 commits
-
In a performance profile, taking a mutex in iscsit_increment_maxcmdsn()
shows up very high. However taking a mutex around "sess->max_cmd_sn += 1"
seems pretty silly: we're not serializing against other contexts in
any useful way.I did a quick audit and there don't appear to be any other places that
use max_cmd_sn within the mutex more than once, so this lock can't be
providing any useful serialization.(Get correct values for logging - fix whitespace damage)
Signed-off-by: Roland Dreier
Signed-off-by: Spencer Baugh
Signed-off-by: Nicholas Bellinger -
This patch adds a new tpg_enabled_sendtargets configfs attribute
to allow in-band sendtargets discovery information to include
target-portal-groups (TPGs) in !TPG_STATE_ACTIVE state.This functionality is useful for clustered iSCSI targets, where
TPGTs handled on remote cluster nodes should be advertised in
the SendTargets response.By default, this new attribute retains the default behaviour of
existing code which to ignore portal-groups in !TPG_STATE_ACTIVE
state.Signed-off-by: David Disseldorp
Signed-off-by: Nicholas Bellinger
31 Jul, 2015
4 commits
-
On x86-64, these changes reduce the struct size from 528 bytes to 496
bytes. We save a cacheline and get under 512 bytes for better packing.Signed-off-by: Roland Dreier
Acked-by: Sagi Grimberg
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
For every command, we set se_ordered_id by doing atomic_inc_return on
dev->dev_ordered_id for the corresponding device. However, the only
places this value gets used are in pr_debug() calls, which doesn't
seem worth an extra atomic op per IO.Signed-off-by: Roland Dreier
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
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 -
The lun_flags field is not used, so drop it.
Signed-off-by: Chris Zankel
Signed-off-by: Spencer Baugh
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger
25 Jul, 2015
1 commit
-
This patch fixes a regression introduced with the following commit
in v4.0-rc1 code, where a iscsit_start_kthreads() failure triggers
a NULL pointer dereference OOPs:commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca
Author: Nicholas Bellinger
Date: Thu Feb 26 22:19:15 2015 -0800iscsi-target: Convert iscsi_thread_set usage to kthread.h
To address this bug, move iscsit_start_kthreads() immediately
preceeding the transmit of last login response, before signaling
a successful transition into full-feature-phase within existing
iscsi_target_do_tx_login_io() logic.This ensures that no target-side resource allocation failures can
occur after the final login response has been successfully sent.Also, it adds a iscsi_conn->rx_login_comp to allow the RX thread
to sleep to prevent other socket related failures until the final
iscsi_post_login_handler() call is able to complete.Cc: Sagi Grimberg
Cc: # v3.10+
Signed-off-by: Nicholas Bellinger
24 Jul, 2015
2 commits
-
In case a LU spans 64bit sectors, fixed size sense data information
field is only 32 bits which means the sector information will be truncated.Thus, if the LU spans 64bit sectors, use descriptor format sense data to
correctly report sector information.Reported-by: Christoph Hellwig
Reviewed-by: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Reviewed-by: Martin K. Petersen
Signed-off-by: Sagi Grimberg
Signed-off-by: Nicholas Bellinger -
If the virtual SAS link is set to 'offline' we should be
queueing an I_T_NEXUS_LOSS_OCCURRED UA.Signed-off-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger
07 Jul, 2015
1 commit
-
Its not a good idea to keep target specific definition of
the same t10-pi tuple.(Fix v4.2-rc1 patch fuzz - nab)
Signed-off-by: Sagi Grimberg
Signed-off-by: Nicholas Bellinger
05 Jul, 2015
1 commit
-
Pull SCSI target updates from Nicholas Bellinger:
"It's been a busy development cycle for target-core in a number of
different areas.The fabric API usage for se_node_acl allocation is now within
target-core code, dropping the external API callers for all fabric
drivers tree-wide.There is a new conversion to RCU hlists for se_node_acl and
se_portal_group LUN mappings, that turns fast-past LUN lookup into a
completely lockless code-path. It also removes the original
hard-coded limitation of 256 LUNs per fabric endpoint.The configfs attributes for backends can now be shared between core
and driver code, allowing existing drivers to use common code while
still allowing flexibility for new backend provided attributes.The highlights include:
- Merge sbc_verify_dif_* into common code (sagi)
- Remove iscsi-target support for obsolete IFMarker/OFMarker
(Christophe Vu-Brugier)
- Add bidi support in target/user backend (ilias + vangelis + agover)
- Move se_node_acl allocation into target-core code (hch)
- Add crc_t10dif_update common helper (akinobu + mkp)
- Handle target-core odd SGL mapping for data transfer memory
(akinobu)
- Move transport ID handling into target-core (hch)
- Move task tag into struct se_cmd + support 64-bit tags (bart)
- Convert se_node_acl->device_list[] to RCU hlist (nab + hch +
paulmck)
- Convert se_portal_group->tpg_lun_list[] to RCU hlist (nab + hch +
paulmck)
- Simplify target backend driver registration (hch)
- Consolidate + simplify target backend attribute implementations
(hch + nab)
- Subsume se_port + t10_alua_tg_pt_gp_member into se_lun (hch)
- Drop lun_sep_lock for se_lun->lun_se_dev RCU usage (hch + nab)
- Drop unnecessary core_tpg_register TFO parameter (nab)
- Use 64-bit LUNs tree-wide (hannes)
- Drop left-over TARGET_MAX_LUNS_PER_TRANSPORT limit (hannes)"* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (76 commits)
target: Bump core version to v5.0
target: remove target_core_configfs.h
target: remove unused TARGET_CORE_CONFIG_ROOT define
target: consolidate version defines
target: implement WRITE_SAME with UNMAP bit using ->execute_unmap
target: simplify UNMAP handling
target: replace se_cmd->execute_rw with a protocol_data field
target/user: Fix inconsistent kmap_atomic/kunmap_atomic
target: Send UA when changing LUN inventory
target: Send UA upon LUN RESET tmr completion
target: Send UA on ALUA target port group change
target: Convert se_lun->lun_deve_lock to normal spinlock
target: use 'se_dev_entry' when allocating UAs
target: Remove 'ua_nacl' pointer from se_ua structure
target_core_alua: Correct UA handling when switching states
xen-scsiback: Fix compile warning for 64-bit LUN
target: Remove TARGET_MAX_LUNS_PER_TRANSPORT
target: use 64-bit LUNs
target: Drop duplicate + unused se_dev_check_wce
target: Drop unnecessary core_tpg_register TFO parameter
...
24 Jun, 2015
1 commit
-
Pull SCSI updates from James Bottomley:
"This is the usual grab bag of driver updates (lpfc, hpsa,
megaraid_sas, cxgbi, be2iscsi) plus an assortment of minor updates.There is also one new driver: the Cisco snic. The advansys driver has
been rewritten to get rid of the warning about converting it to the
DMA API, the tape statistics patch got in and finally, there's a
resuffle of SCSI header files to separate more cleanly initiator from
target mode (and better share the common definitions)"* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (156 commits)
snic: driver for Cisco SCSI HBA
qla2xxx: Fix indentation
qla2xxx: Comment out unreachable code
fusion: remove dead MTRR code
advansys: fix compilation errors and warnings when CONFIG_PCI is not set
mptsas: fix depth param in scsi_track_queue_full
megaraid: fix irq setup process regression
lpfc: Update version to 10.7.0.0 for upstream patch set.
lpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes
lpfc: Fix scsi task management error message.
lpfc: Fix cq_id masking problem.
lpfc: Fix scsi prep dma buf error.
lpfc: Add support for using block multi-queue
lpfc: Devices are not discovered during takeaway/giveback testing
lpfc: Fix vport deletion failure.
lpfc: Check for active portpeerbeacon.
lpfc: Update driver version for upstream patch set 10.6.0.1.
lpfc: Change buffer pool empty message to miscellaneous category
lpfc: Fix incorrect log message reported for empty FCF record.
lpfc: Fix rport leak.
...
23 Jun, 2015
7 commits
-
Signed-off-by: Nicholas Bellinger
-
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 -
Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Move a little more processing into the core code, and lift the previous
do_unmap callback into the sbc_ops structure.Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger -
Instead of leaking this SBC read/write implementation detail just add an
opaqueue protocol specific pointer to struct se_cmd that we can assign
the sbc_ops vector to.Signed-off-by: Christoph Hellwig
Reviewed-by: Andy Grover
Signed-off-by: Nicholas Bellinger
16 Jun, 2015
4 commits
-
Unused.
Signed-off-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
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 -
This patch drops unnecessary target_core_fabric_ops parameter usage
for core_tpg_register() during fabric driver TFO->fabric_make_tpg()
se_portal_group creation callback execution.Instead, use the existing se_wwn->wwn_tf->tf_ops pointer to ensure
fabric driver is really using the same TFO provided at module_init
time.Also go ahead and drop the forward TFO declarations tree-wide, and
handling the special case for iscsi-target discovery TPG.Cc: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger
02 Jun, 2015
2 commits
-
Only include SCSI initiator header files in target code that needs
these header files, namely the SCSI pass-through code and the tcm_loop
driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in
target code because the former is intended for initiator code and the
latter for target code. With this patch the only initiator include
directives in target code that remain are as follows:$ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
drivers/target/loopback/tcm_loop.c:29:#include
drivers/target/loopback/tcm_loop.c:31:#include
drivers/target/loopback/tcm_loop.c:32:#include
drivers/target/loopback/tcm_loop.c:33:#include
drivers/target/target_core_pscsi.c:39:#include
drivers/target/target_core_pscsi.c:40:#include
drivers/xen/xen-scsiback.c:52:#include /* SG_ALL */Signed-off-by: Bart Van Assche
Reviewed-by: Christoph Hellwig
Signed-off-by: James Bottomley -
Correct the comment above the definition of TCM_MAX_COMMAND_SIZE.
A quote from Christoph:There aren't any legacy issues, we just decided to handle >
16 byte CDBs in the slow path.Signed-off-by: Bart Van Assche
Reviewed-by: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Signed-off-by: James Bottomley
01 Jun, 2015
9 commits
-
With se_port_t and t10_alua_tg_pt_gp_member being absored into se_lun,
there is no need for an extra atomic_t based reference count for PR
ALL_TG_PT=1 and ALUA access state transition.Go ahead and use the existing percpu se_lun->lun_ref instead, and
convert the two special cases to percpu_ref_tryget_live() to avoid
se_lun if transport_clear_lun_ref() has already been invoked to
shutdown the se_lun.Cc: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
With se_port and t10_alua_tg_pt_gp_member being absored into se_lun,
there is no need for an extra lock to protect se_lun->lun_se_dev
assignment.This patch also converts backend drivers to use call_rcu() release
to allow any se_device readers to complete. The call_rcu() instead
of kfree_rcu() is required here because se_device is embedded into
the backend driver specific structure.Also, convert se_lun->lun_stats to use atomic_long_t within the
target_complete_ok_work() completion callback, and add FIXME for
transport_lookup_tmr_lun() with se_lun->lun_ref.Finally, update sbp_update_unit_directory() special case usage with
proper rcu_dereference_raw() and configfs symlink comment.Reported-by: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Cc: Paul E. McKenney
Cc: Chris Boot
Signed-off-by: Nicholas Bellinger -
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 -
Instead of starting a thread from transport_clear_lun_ref() that
waits for LUN shutdown, wait in that function for LUN shutdown
to finish. Additionally, change the return type of
transport_clear_lun_ref() from int to void.Signed-off-by: Bart Van Assche
Reviewed-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Consolidate the implementation of the backend attributes in a single file
and single function per attribute show/store function instead of splitting
it into multiple functions in multiple files.Also use the proper strto* helpers for exposed data types, add macros to
implement the store methods for the most common data types and share the
show methods between the two different attribute implementations.(Fix bogus store_pi_prot_format flag=0 return value - nab)
Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Provide a common sets of dev_attrib attributes for all devices using the
generic SPC/SBC parsers, and a second one with the minimal required read-only
attributes for passthrough devices. The later is only used by pscsi for now,
but will be wired up for the full-passthrough TCMU use case as well.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Rewrite the backend driver registration based on what we did to the fabric
drivers: introduce a read-only struct target_bakckend_ops that the driver
registers, which is then instanciate as a struct target_backend by the
core. This allows the ops vector to be smaller and allows us to mark it
const. At the same time the registration function can set up the
configfs attributes, avoiding the need to add additional boilerplate code
for that to the drivers.Signed-off-by: Christoph Hellwig
Signed-off-by: Nicholas Bellinger -
Now that se_portal_group->tpg_lun_hlist is a RCU protected hlist,
go ahead and drop the left-over lun->lun_status usage.Reported-by: Christoph Hellwig
Reviewed-by: Hannes Reinecke
Signed-off-by: Nicholas Bellinger -
Reviewed-by: Hannes Reinecke
Cc: Christoph Hellwig
Cc: Sagi Grimberg
Signed-off-by: Nicholas Bellinger