10 Dec, 2016

1 commit

  • Remove superfluous #include directives from the include/target/*.h
    files. Add missing #include directives to other *.h and *.c files.
    Use forward declarations for structures where possible. This
    change reduces the build time for make M=drivers/target on my
    laptop from 27.1s to 18.7s or by about 30%.

    Signed-off-by: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: Bryant G. Ly

    Bart Van Assche
     

20 Oct, 2016

2 commits

  • This patch addresses a bug where a local EXTENDED_COPY WRITE or READ
    backend I/O request would always return SAM_STAT_CHECK_CONDITION,
    even if underlying xcopy_pt_cmd->se_cmd generated a different
    SCSI status code.

    ESX host environments expect to hit SAM_STAT_RESERVATION_CONFLICT
    for certain scenarios, and SAM_STAT_CHECK_CONDITION results in
    non-retriable status for these cases.

    Tested on v4.1.y with ESX v5.5u2+ with local IBLOCK backend copy.

    Reported-by: Nixon Vincent
    Tested-by: Nixon Vincent
    Cc: Nixon Vincent
    Tested-by: Dinesh Israni
    Signed-off-by: Dinesh Israni
    Cc: Dinesh Israni
    Cc: stable@vger.kernel.org # 3.14+
    Signed-off-by: Nicholas Bellinger

    Dinesh Israni
     
  • This patch addresses a bug where EXTENDED_COPY across multiple LUNs
    results in a CHECK_CONDITION when the source + destination are not
    located on the same physical node.

    ESX Host environments expect sense COPY_ABORTED w/ COPY TARGET DEVICE
    NOT REACHABLE to be returned when this occurs, in order to signal
    fallback to local copy method.

    As described in section 6.3.3 of spc4r22:

    "If it is not possible to complete processing of a segment because the
    copy manager is unable to establish communications with a copy target
    device, because the copy target device does not respond to INQUIRY,
    or because the data returned in response to INQUIRY indicates
    an unsupported logical unit, then the EXTENDED COPY command shall be
    terminated with CHECK CONDITION status, with the sense key set to
    COPY ABORTED, and the additional sense code set to COPY TARGET DEVICE
    NOT REACHABLE."

    Tested on v4.1.y with ESX v5.5u2+ with BlockCopy across multiple nodes.

    Reported-by: Nixon Vincent
    Tested-by: Nixon Vincent
    Cc: Nixon Vincent
    Tested-by: Dinesh Israni
    Signed-off-by: Dinesh Israni
    Cc: Dinesh Israni
    Cc: stable@vger.kernel.org # 3.14+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

14 May, 2016

1 commit

  • The SRP target driver will need to allocate and chain it's own SGLs soon.
    For this export target_alloc_sgl, and add a new argument to it so that it
    can allocate an additional chain entry that doesn't point to a page. Also
    export transport_free_sgl after renaming it to target_free_sgl to free
    these SGLs again.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Bart Van Assche
    Signed-off-by: Doug Ledford

    Christoph Hellwig
     

11 Sep, 2015

1 commit

  • This patch is a >= v4.1 regression bug-fix where control CDB
    emulation logic in commit 38b57f82 now expects a se_cmd->se_sess
    pointer to exist when determining T10-PI support is to be exposed
    for initiator host ports.

    To address this bug, go ahead and add locally generated se_cmd
    descriptors for copy-offload block-copy to it's own stand-alone
    se_session nexus, while the parent EXTENDED_COPY se_cmd descriptor
    remains associated with it's originating se_cmd->se_sess nexus.

    Note a valid se_cmd->se_sess is also required for future support
    of WRITE_INSERT and READ_STRIP software emulation when submitting
    backend I/O to se_device that exposes T10-PI suport.

    Reported-by: Alex Gorbachev
    Tested-by: Alex Gorbachev
    Cc: "Martin K. Petersen"
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Cc: Doug Gilbert
    Cc: # v4.1+
    Signed-off-by: Nicholas Bellinger

    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
    ...

    Linus Torvalds
     

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.
    ...

    Linus Torvalds
     

02 Jun, 2015

1 commit

  • 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

    Bart Van Assche
     

01 Jun, 2015

1 commit

  • 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

    Christoph Hellwig
     

31 May, 2015

3 commits

  • Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Simplify target core and target drivers by storing the task tag
    a.k.a. command identifier inside struct se_cmd.

    For several transports (e.g. SRP) tags are 64 bits wide.
    Hence add support for 64-bit tags.

    (Fix core_tmr_abort_task conversion spec warnings - nab)
    (Fix up usb-gadget to use 16-bit tags - HCH + bart)

    Signed-off-by: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: Andy Grover
    Cc: Sagi Grimberg
    Cc:
    Cc: Felipe Balbi
    Cc: Michael S. Tsirkin
    Cc: Juergen Gross
    Signed-off-by: Nicholas Bellinger

    Bart Van Assche
     
  • There is just one configfs subsystem in the target code, so we might as
    well add two helpers to reference / unreference it from the core code
    instead of passing pointers to it around.

    This fixes a regression introduced for v4.1-rc1 with commit 9ac8928e6,
    where configfs_depend_item() callers using se_tpg_tfo->tf_subsys would
    fail, because the assignment from the original target_core_subsystem[]
    is no longer happening at target_register_template() time.

    (Fix target_core_exit_configfs pointer dereference - Sagi)

    Signed-off-by: Christoph Hellwig
    Reported-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

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

    Christoph Hellwig
     

08 Apr, 2015

2 commits


27 Mar, 2015

1 commit


20 Nov, 2014

1 commit


07 Jun, 2014

1 commit


10 Jan, 2014

1 commit

  • Move prototype declaration of function
    spc_parse_naa_6h_vendor_specific() from target_core_xcopy.c to header
    file target_core_pr.h because it is used by more than one file.

    This eliminates the following warning in target_core_spc.c:
    drivers/target/target_core_spc.c:138:6: warning: no previous prototype for ‘spc_parse_naa_6h_vendor_specific’ [-Wmissing-prototypes]

    Signed-off-by: Rashika Kheria
    Reviewed-by: Josh Triplett
    Signed-off-by: Nicholas Bellinger

    Rashika Kheria
     

23 Nov, 2013

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "Things have been quiet this round with mostly bugfixes, percpu
    conversions, and other minor iscsi-target conformance testing changes.

    The highlights include:

    - Add demo_mode_discovery attribute for iscsi-target (Thomas)
    - Convert tcm_fc(FCoE) to use percpu-ida pre-allocation
    - Add send completion interrupt coalescing for ib_isert
    - Convert target-core to use percpu-refcounting for se_lun
    - Fix mutex_trylock usage bug in iscsit_increment_maxcmdsn
    - tcm_loop updates (Hannes)
    - target-core ALUA cleanups + prep for v3.14 SCSI Referrals support (Hannes)

    v3.14 is currently shaping to be a busy development cycle in target
    land, with initial support for T10 Referrals and T10 DIF currently on
    the roadmap"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (40 commits)
    iscsi-target: chap auth shouldn't match username with trailing garbage
    iscsi-target: fix extract_param to handle buffer length corner case
    iscsi-target: Expose default_erl as TPG attribute
    target_core_configfs: split up ALUA supported states
    target_core_alua: Make supported states configurable
    target_core_alua: Store supported ALUA states
    target_core_alua: Rename ALUA_ACCESS_STATE_OPTIMIZED
    target_core_alua: spellcheck
    target core: rename (ex,im)plict -> (ex,im)plicit
    percpu-refcount: Add percpu-refcount.o to obj-y
    iscsi-target: Do not reject non-immediate CmdSNs exceeding MaxCmdSN
    iscsi-target: Convert iscsi_session statistics to atomic_long_t
    target: Convert se_device statistics to atomic_long_t
    target: Fix delayed Task Aborted Status (TAS) handling bug
    iscsi-target: Reject unsupported multi PDU text command sequence
    ib_isert: Avoid duplicate iscsit_increment_maxcmdsn call
    iscsi-target: Fix mutex_trylock usage in iscsit_increment_maxcmdsn
    target: Core does not need blkdev.h
    target: Pass through I/O topology for block backstores
    iser-target: Avoid using FRMR for single dma entry requests
    ...

    Linus Torvalds
     

09 Nov, 2013

1 commit


08 Nov, 2013

2 commits

  • Now with percpu refcounting for se_lun in place, go ahead and drop
    the legacy per se_cmd accounting for se_lun shutdown.

    This includes __transport_clear_lun_from_sessions(), the associated
    transport_lun_wait_for_tasks() logic, along with a handful of now
    unused se_cmd structure members and ->transport_state bits.

    Cc: Kent Overstreet
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds percpu refcounting for se_lun access that allows the
    association of an se_lun + se_cmd in transport_lookup_cmd_lun() to
    occur without an extra list_head for tracking outstanding I/O during
    se_lun shutdown.

    This effectively changes se_lun shutdown logic to wait for outstanding
    I/O percpu references to complete in transport_lun_remove_cmd() using
    se_lun->lun_ref_comp, instead of explicitly draining the per se_lun
    command list and waiting for individual se_cmd descriptor processing
    to complete.

    Cc: Kent Overstreet
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

24 Oct, 2013

3 commits

  • This patch adds an explicit check + failure for XCOPY I/O to source +
    destination devices with a non-matching block_size.

    This limitiation is currently due to the fact that the scatterlist
    memory allocated for the XCOPY READ operation is passed zero-copy
    to the XCOPY WRITE operation.

    Reported-by: Thomas Glanzmann
    Reported-by: Douglas Gilbert
    Cc: Thomas Glanzmann
    Cc: Douglas Gilbert
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds the missing non-zero se_cmd->scsi_status check required
    for local XCOPY I/O within target_xcopy_issue_pt_cmd() to signal an
    exception case failure.

    This will trigger the generation of SAM_STAT_CHECK_CONDITION status
    from within target_xcopy_do_work() process context code.

    Reported-by: Thomas Glanzmann
    Reported-by: Douglas Gilbert
    Cc: Thomas Glanzmann
    Cc: Douglas Gilbert
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds the missing xcopy_pt_cmd->sense_buffer[] required for
    correctly handling CHECK_CONDITION exceptions within the locally
    generated XCOPY I/O path.

    Also update target_xcopy_read_source() + target_xcopy_setup_pt_cmd()
    to pass this buffer into transport_init_se_cmd() to correctly setup
    se_cmd->sense_buffer.

    Reported-by: Thomas Glanzmann
    Reported-by: Douglas Gilbert
    Cc: Thomas Glanzmann
    Cc: Douglas Gilbert
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

09 Oct, 2013

3 commits

  • This patch rejects EXTENDED_COPY when the emulate_3pc attribute has
    been explicitly disabled for the receiving device.

    It also adds a similar check in target_xcopy_locate_se_dev_e4() to
    ignore these devices when doing a search based upon the identifier
    WWN provided by EXTENDED_COPY parameter list target descriptors.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch changes target_do_xcopy() to allow processing of non-zero
    ListIDs in EXTENDED_COPY parameter list data, instead of returning
    CHECK_CONDITION status.

    As the copy offload implementation reports SNLID=1 (Supports No ListID)
    in OPERATING PARAMETERS, any ListID value presented by the client is
    currently ignored.

    Also, properly extract list_id_usage for informational purposes.

    Reported-by: Thomas Glanzmann
    Reported-by: Douglas Gilbert
    Cc: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch changes target_do_xcopy() to properly return
    TCM_INVALID_PARAMETER_LIST instead of TCM_INVALID_CDB_FIELD
    for failures related to the EXTENDED_COPY parameter list parsing.

    Also, move struct xcopy_op allocation ahead of kmapping to
    handle the special TCM_OUT_OF_RESOURCES case.

    Reported-by: Thomas Glanzmann
    Reported-by: Douglas Gilbert
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

02 Oct, 2013

1 commit


11 Sep, 2013

2 commits

  • Remove including that don't need it.

    Signed-off-by: Wei Yongjun
    Signed-off-by: Nicholas Bellinger

    Wei Yongjun
     
  • This patch adds support for EXTENDED_COPY emulation from SPC-3, that
    enables full copy offload target support within both a single virtual
    backend device, and across multiple virtual backend devices. It also
    functions independent of target fabric, and supports copy offload
    across multiple target fabric ports.

    This implemenation supports both EXTENDED_COPY PUSH and PULL models
    of operation, so the actual CDB may be received on either source or
    desination logical unit.

    For Target Descriptors, it currently supports the NAA IEEE Registered
    Extended designator (type 0xe4), which allows the reference of target
    ports to occur independent of fabric type using EVPD 0x83 WWNs.

    For Segment Descriptors, it currently supports copy from block to
    block (0x02) mode.

    It also honors any present SCSI reservations of the destination target
    port. Note that only Supports No List Identifier (SNLID=1) mode is
    supported.

    Also included is basic RECEIVE_COPY_RESULTS with service action type
    OPERATING PARAMETERS (0x03) required for SNLID=1 operation.

    v3 changes:
    - Fix incorrect return type in target_do_receive_copy_results()
    (Fengguang)

    v2 changes:
    - Use target_alloc_sgl() instead of transport_generic_get_mem()
    - Convert debug output to use pr_debug()
    - Convert target_xcopy_parse_target_descriptors() NAA IEEN WWN
    dump to use 0x%16phN format specification
    - Drop unnecessary xcopy_pt_cmd->xpt_passthrough_wsem, and
    associated usage in xcopy_pt_write_pending() and
    target_xcopy_issue_pt_cmd()
    - Add check for unsupported EXTENDED_COPY(LID4) service action
    bits in target_do_xcopy()

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: Roland Dreier
    Cc: Zach Brown
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger