07 Apr, 2014

7 commits

  • Split up __sbc_dif_verify_read() so that VERIFY READ emulation can
    perform target-core specific READ_STRIP, seperate from the existing
    FILEIO/RAMDISK backend emulation code.

    Also add sbc_dif_read_strip() in order to determine number of sectors
    using cmd->prot_length, and skip the extra sbc_dif_copy_prot().

    Reviewed-by: Sagi Grimberg
    Cc: Martin K. Petersen
    Cc: Or Gerlitz
    Cc: Quinn Tran
    Cc: Giridhar Malavali
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds WRITE_INSERT emulation within target-core
    using TYPE1 / TYPE3 PI modes in sbc_dif_generate() code.

    This is useful in order for existing legacy fabrics that do not
    support protection offloads to interact with backend devices that
    currently have T10 PI enabled.

    v2 changes:
    - Rename to sbc_dif_generate() (Sagi)

    Cc: Martin K. Petersen
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Cc: Quinn Tran
    Cc: Giridhar Malavali
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • In order to support local WRITE_INSERT + READ_STRIP operations for
    non PI enabled fabrics, the fabric driver needs to be able signal
    what protection offload operations are supported.

    This is done at session initialization time so the modes can be
    signaled by individual se_wwn + se_portal_group endpoints, as well
    as optionally across different transports on the same endpoint.

    For iser-target, set TARGET_PROT_ALL if the underlying ib_device
    has already signaled PI offload support, and allow this to be
    exposed via a new iscsit_transport->iscsit_get_sup_prot_ops()
    callback.

    For loopback, set TARGET_PROT_ALL to signal SCSI initiator mode
    operation.

    For all other drivers, set TARGET_PROT_NORMAL to disable fabric
    level PI.

    Cc: Martin K. Petersen
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Cc: Quinn Tran
    Cc: Giridhar Malavali
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Now that TASK_ABORTED status is not generated for all cases by
    TMR ABORT_TASK + LUN_RESET, a new TFO->abort_task() caller is
    necessary in order to give fabric drivers a chance to unmap
    hardware / software resources before the se_cmd descriptor is
    released via the normal TFO->release_cmd() codepath.

    This patch adds TFO->aborted_task() in core_tmr_abort_task()
    in place of the original transport_send_task_abort(), and
    also updates all fabric drivers to implement this caller.

    The fabric drivers that include changes to perform cleanup
    via ->aborted_task() are:

    - iscsi-target
    - iser-target
    - srpt
    - tcm_qla2xxx

    The fabric drivers that currently set ->aborted_task() to
    NOPs are:

    - loopback
    - tcm_fc
    - usb-gadget
    - sbp-target
    - vhost-scsi

    For the latter five, there appears to be no additional cleanup
    required before invoking TFO->release_cmd() to release the
    se_cmd descriptor.

    v2 changes:
    - Move ->aborted_task() call into transport_cmd_finish_abort (Alex)

    Cc: Alex Leung
    Cc: Mark Rustad
    Cc: Roland Dreier
    Cc: Vu Pham
    Cc: Chris Boot
    Cc: Sebastian Andrzej Siewior
    Cc: Michael S. Tsirkin
    Cc: Giridhar Malavali
    Cc: Saurav Kashyap
    Cc: Quinn Tran
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch addresses three of long standing issues wrt to Task
    Aborted Status (TAS) handling.

    The first is the incorrect assumption in core_tmr_handle_tas_abort()
    that TASK_ABORTED status is sent for the task referenced by TMR
    ABORT_TASK, and sending TASK_ABORTED status for TMR LUN_RESET on
    the same nexus the LUN_RESET was received.

    The second is to ensure the lun reference count is dropped within
    transport_cmd_finish_abort() by calling transport_lun_remove_cmd()
    before invoking transport_cmd_check_stop_to_fabric().

    The last is to fix the delayed TAS handling to allow outstanding
    WRITEs to complete before sending the TASK_ABORTED status. This
    includes changing transport_check_aborted_status() to avoid
    processing when SCF_SEND_DELAYED_TAS has not be set, and updating
    transport_send_task_abort() to drop the SCF_SENT_DELAYED_TAS
    check.

    Signed-off-by: Alex Leung
    Cc: Alex Leung
    Signed-off-by: Nicholas Bellinger

    Alex Leung
     
  • This is not going to be supported soon - so drop it.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     
  • Some transports (iSCSI/iSER/SRP/FC) support hardware INSERT/STRIP
    capabilities while other transports like loopback/vhost-scsi need
    perform this is software.

    This patch allows fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC
    to signal the early LUN scan handling case where PROTECT CDB bits
    are set, but no fabric buffer has been provided.

    For transports which use generic new command these buffers have yet
    to be allocated.

    Also this way, target may support protection information
    against legacy initiators (writes are inserted and reads
    are stripped).

    (Only set prot_pto for loopback during early special case - nab)

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     

14 Mar, 2014

1 commit

  • SBC-3 mandates the protection checks that must be
    performed in the rdprotect/wrprotect field. Use them.
    According to backstore device pi_attributes and
    cdb rdprotect/wrprotect field.

    (Fix incorrect se_cmd->prot_type -> TARGET_PROT_NORMAL
    comparision in transport_generic_new_cmd - nab)
    (Fix missing break in sbc_set_prot_op_checks - DanC + Sagi)

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     

05 Mar, 2014

1 commit

  • This patch addresses a couple of different hug shutdown issues
    related to wait_event() + isert_conn->state. First, it changes
    isert_conn->conn_wait + isert_conn->conn_wait_comp_err from
    waitqueues to completions, and sets ISER_CONN_TERMINATING from
    within isert_disconnect_work().

    Second, it splits isert_free_conn() into isert_wait_conn() that
    is called earlier in iscsit_close_connection() to ensure that
    all outstanding commands have completed before continuing.

    Finally, it breaks isert_cq_comp_err() into seperate TX / RX
    related code, and adds logic in isert_cq_rx_comp_err() to wait
    for outstanding commands to complete before setting ISER_CONN_DOWN
    and calling complete(&isert_conn->conn_wait_comp_err).

    Acked-by: Sagi Grimberg
    Cc: Or Gerlitz
    Cc: #3.10+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

13 Feb, 2014

1 commit


01 Feb, 2014

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "The highlights this round include:

    - add support for SCSI Referrals (Hannes)
    - add support for T10 DIF into target core (nab + mkp)
    - add support for T10 DIF emulation in FILEIO + RAMDISK backends (Sagi + nab)
    - add support for T10 DIF -> bio_integrity passthrough in IBLOCK backend (nab)
    - prep changes to iser-target for >= v3.15 T10 DIF support (Sagi)
    - add support for qla2xxx N_Port ID Virtualization - NPIV (Saurav + Quinn)
    - allow percpu_ida_alloc() to receive task state bitmask (Kent)
    - fix >= v3.12 iscsi-target session reset hung task regression (nab)
    - fix >= v3.13 percpu_ref se_lun->lun_ref_active race (nab)
    - fix a long-standing network portal creation race (Andy)"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (51 commits)
    target: Fix percpu_ref_put race in transport_lun_remove_cmd
    target/iscsi: Fix network portal creation race
    target: Report bad sector in sense data for DIF errors
    iscsi-target: Convert gfp_t parameter to task state bitmask
    iscsi-target: Fix connection reset hang with percpu_ida_alloc
    percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask
    iscsi-target: Pre-allocate more tags to avoid ack starvation
    qla2xxx: Configure NPIV fc_vport via tcm_qla2xxx_npiv_make_lport
    qla2xxx: Enhancements to enable NPIV support for QLOGIC ISPs with TCM/LIO.
    qla2xxx: Fix scsi_host leak on qlt_lport_register callback failure
    IB/isert: pass scatterlist instead of cmd to fast_reg_mr routine
    IB/isert: Move fastreg descriptor creation to a function
    IB/isert: Avoid frwr notation, user fastreg
    IB/isert: seperate connection protection domains and dma MRs
    tcm_loop: Enable DIF/DIX modes in SCSI host LLD
    target/rd: Add DIF protection into rd_execute_rw
    target/rd: Add support for protection SGL setup + release
    target/rd: Refactor rd_build_device_space + rd_release_device_space
    target/file: Add DIF protection support to fd_execute_rw
    target/file: Add DIF protection init/format support
    ...

    Linus Torvalds
     

30 Jan, 2014

1 commit

  • This patch fixes a percpu_ref_put race for se_lun->lun_ref in
    transport_lun_remove_cmd() where ->lun_ref could end up being
    put more than once per command via different target completion
    and fabric release contexts.

    It adds a cmpxchg() for se_cmd->lun_ref_active to ensure that
    percpu_ref_put() is only ever called once per se_cmd.

    This bug was manifesting itself as a LUN shutdown regression
    bug in >= v3.13 code, where percpu_ref_kill() would end up
    hanging indefinately due to the incorrect percpu_ref count.

    (Change se_cmd->lun_ref_active from bool -> int to force at
    least a 4-byte cmpxchg with MIPS ll/sc ins. - Fengguang)

    Reported-by: Tommy Apel
    Cc: Tommy Apel
    Cc: #3.13+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

25 Jan, 2014

2 commits


18 Jan, 2014

4 commits

  • This patch adds support to target_submit_cmd_map_sgls() for
    accepting 'sgl_prot' + 'sgl_prot_count' parameters for
    DIF protection information.

    Note the passed parameters are stored at se_cmd->t_prot_sg
    and se_cmd->t_prot_nents respectively.

    Also, update tcm_loop and vhost-scsi fabrics usage of
    target_submit_cmd_map_sgls() to take into account the
    new parameters.

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF read/write verify emulation
    for TARGET_DIF_TYPE1_PROT + TARGET_DIF_TYPE3_PROT operation.

    This includes sbc_dif_verify_write() + sbc_dif_verify_read()
    calls accessable by backend drivers to perform DIF verify
    for SGL based data and protection information.

    Also included is sbc_dif_copy_prot() logic to copy protection
    information to/from backend provided protection SGLs.

    Based on scsi_debug.c DIF TYPE1+TYPE3 emulation.

    v2 changes:
    - Select CRC_T10DIF for TARGET_CORE in Kconfig (Fengguang)
    - Drop IP checksum logic from sbc_dif_v1_verify (MKP)
    - Fix offset on app_tag = 0xffff in sbc_dif_verify_read()

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF related CHECK_CONDITION ASC/ASCQ
    exception cases into transport_send_check_condition_and_sense().

    This includes:

    LOGICAL BLOCK GUARD CHECK FAILED
    LOGICAL BLOCK APPLICATION TAG CHECK FAILED
    LOGICAL BLOCK REFERENCE TAG CHECK FAILED

    that used by DIF TYPE1 and TYPE3 failure cases.

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds DIF related definitions to target_core_base.h
    that includes enums for target_prot_op + target_prot_type +
    target_prot_version + target_guard_type + target_pi_error.

    Also included is struct se_dif_v1_tuple, along with changes
    to struct se_cmd, struct se_dev_attrib, and struct se_device.

    Also, add new se_subsystem_api->[init,format,free]_prot() callers
    used by target core code to setup backend specific protection
    information after the device has been configured.

    Enums taken from Sagi Grimberg's original patch.

    v2 changes:
    - Drop guard_type related definitions
    - Update target_prot_op + target_prot_ho definitions (Sagi)
    - Drop SCF_PROT + pi_prot_version flag
    - Add se_subsystem_api->format_prot() (Sagi)
    - Add hw_pi_prot_type device attribute

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

10 Jan, 2014

2 commits

  • This patch converts the temporary buffer in spc_emulate_inquiry() to
    use dynamically allocated memory, instead of local stack memory.

    Also bump SE_INQUIRY_BUF up to 1024 bytes to be safe when handling
    multiple large SCSI name descriptors for EVPD=0x83.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Add infrastructure for referrals.

    v2 changes:

    - Fix unsigned long long division in core_alua_state_lba_dependent on
    32-bit (Fengguang + Chen + Hannes)
    - Fix compile warning in core_alua_state_lba_dependent (nab)
    - Convert segment_* + sectors variables in core_alua_state_lba_dependent
    to u64 (Hannes)

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     

19 Dec, 2013

1 commit

  • This patch allows FILEIO to update hw_max_sectors based on the current
    max_bytes_per_io. This is required because vfs_[writev,readv]() can accept
    a maximum of 2048 iovecs per call, so the enforced hw_max_sectors really
    needs to be calculated based on block_size.

    This addresses a >= v3.5 bug where block_size=512 was rejecting > 1M
    sized I/O requests, because FD_MAX_SECTORS was hardcoded to 2048 for
    the block_size=4096 case.

    (v2: Use max_bytes_per_io instead of ->update_hw_max_sectors)

    Reported-by: Henrik Goldman
    Cc: #3.5+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

18 Dec, 2013

4 commits


17 Dec, 2013

1 commit


12 Dec, 2013

1 commit


21 Nov, 2013

2 commits


14 Nov, 2013

1 commit


13 Nov, 2013

1 commit

  • In addition to block size (already implemented), passing through
    alignment offset, logical-to-phys block exponent, I/O granularity and
    optimal I/O length will allow initiators to properly handle layout on
    LUNs with 4K block sizes.

    Tested with various weird values via scsi_debug module.

    One thing to look at with this patch is the new block limits values --
    instead of granularity 1 optimal 8192, Lio will now be returning whatever
    the block device says, which may affect performance.

    Signed-off-by: Andy Grover
    Acked-by: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

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

1 commit


17 Oct, 2013

2 commits


11 Sep, 2013

3 commits

  • Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds the Third Party Copy (3PC) bit to signal support
    for EXTENDED_COPY within standard inquiry response data.

    Also add emulate_3pc device attribute in configfs (enabled by default)
    to allow the exposure of this bit to be disabled, if necessary.

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