18 Sep, 2014

1 commit


12 Jun, 2014

1 commit

  • When an initiator sends an allocation length bigger than what its
    command consumes, the target should only return the actual response data
    and set the residual length to the unused part of the allocation length.

    Add a helper function that command handlers (INQUIRY, READ CAPACITY,
    etc) can use to do this correctly, and use this code to get the correct
    residual for commands that don't use the full initiator allocation in the
    handlers for READ CAPACITY, READ CAPACITY(16), INQUIRY, MODE SENSE and
    REPORT LUNS.

    This addresses a handful of failures as reported by Christophe with
    the Windows Certification Kit:

    http://permalink.gmane.org/gmane.linux.scsi.target.devel/6515

    Signed-off-by: Roland Dreier
    Tested-by: Christophe Vu-Brugier
    Cc: stable@vger.kernel.org # 3.10+
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     

07 Jun, 2014

1 commit


07 Apr, 2014

2 commits


13 Feb, 2014

1 commit

  • Commit fbfe858fea2a ("target_core_spc: Include target device
    descriptor in VPD page 83") added a new length variable, but (due to a
    cut and paste mistake?) just checks scsi_name_len against 256 twice.
    Fix this to check scsi_target_len for overflow too.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     

18 Jan, 2014

3 commits


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
     

18 Dec, 2013

2 commits


21 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
     

13 Sep, 2013

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "Lots of activity again this round for I/O performance optimizations
    (per-cpu IDA pre-allocation for vhost + iscsi/target), and the
    addition of new fabric independent features to target-core
    (COMPARE_AND_WRITE + EXTENDED_COPY).

    The main highlights include:

    - Support for iscsi-target login multiplexing across individual
    network portals
    - Generic Per-cpu IDA logic (kent + akpm + clameter)
    - Conversion of vhost to use per-cpu IDA pre-allocation for
    descriptors, SGLs and userspace page pointer list
    - Conversion of iscsi-target + iser-target to use per-cpu IDA
    pre-allocation for descriptors
    - Add support for generic COMPARE_AND_WRITE (AtomicTestandSet)
    emulation for virtual backend drivers
    - Add support for generic EXTENDED_COPY (CopyOffload) emulation for
    virtual backend drivers.
    - Add support for fast memory registration mode to iser-target (Vu)

    The patches to add COMPARE_AND_WRITE and EXTENDED_COPY support are of
    particular significance, which make us the first and only open source
    target to support the full set of VAAI primitives.

    Currently Linux clients are lacking upstream support to actually
    utilize these primitives. However, with server side support now in
    place for folks like MKP + ZAB working on the client, this logic once
    reserved for the highest end of storage arrays, can now be run in VMs
    on their laptops"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits)
    target/iscsi: Bump versions to v4.1.0
    target: Update copyright ownership/year information to 2013
    iscsi-target: Bump default TCP listen backlog to 256
    target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out
    iscsi-target; Bump default CmdSN Depth to 64
    iscsi-target: Remove unnecessary wait_for_completion in iscsi_get_thread_set
    iscsi-target: Add thread_set->ts_activate_sem + use common deallocate
    iscsi-target: Fix race with thread_pre_handler flush_signals + ISCSI_THREAD_SET_DIE
    target: remove unused including
    iser-target: introduce fast memory registration mode (FRWR)
    iser-target: generalize rdma memory registration and cleanup
    iser-target: move rdma wr processing to a shared function
    target: Enable global EXTENDED_COPY setup/release
    target: Add Third Party Copy (3PC) bit in INQUIRY response
    target: Enable EXTENDED_COPY setup in spc_parse_cdb
    target: Add support for EXTENDED_COPY copy offload emulation
    target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check
    target: Add global device list for EXTENDED_COPY
    target: Make helpers non static for EXTENDED_COPY command setup
    target: Make spc_parse_naa_6h_vendor_specific non static
    ...

    Linus Torvalds
     

11 Sep, 2013

4 commits


10 Sep, 2013

1 commit

  • This patch adds the MAXIMUM COMPARE AND WRITE LENGTH bit, currently
    hardcoded to a single logical block (NoLB=1) within the Block Limits
    VPD in spc_emulate_evpd_b0().

    Also add emulate_caw 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: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

13 Aug, 2013

1 commit

  • This patch fixes spc_emulate_inquiry_std() to add trailing ASCII
    spaces for INQUIRY vendor + model fields following SPC-4 text:

    "ASCII data fields described as being left-aligned shall have any
    unused bytes at the end of the field (i.e., highest offset) and
    the unused bytes shall be filled with ASCII space characters (20h)."

    This addresses a problem with Falconstor NSS multipathing.

    Reported-by: Tomas Molota
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

14 Feb, 2013

3 commits

  • An empty parameter list (length == 0) is not an error, so succeed MODE
    SELECT in this case. If the parameter list length is too small,
    return the correct sense code of PARAMETER LIST LENGTH ERROR.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch allows IBLOCK to check block hints in request_queue->flush_flags
    when reporting current backend device WriteCacheEnabled status to a remote
    SCSI initiator port.

    This is done via a se_subsystem_api->get_write_cache() call instead of a
    backend se_device creation time flag, as we expect REQ_FLUSH bits to possibly
    change from an underlying blk_queue_flush() by the SCSI disk driver, or
    internal raw struct block_device driver usage.

    Also go ahead and update iblock_execute_rw() bio I/O path code to use
    REQ_FLUSH + REQ_FUA hints when determining WRITE_FUA usage, and make SPC
    emulation code use a spc_check_dev_wce() helper to handle both types of
    cases for virtual backend subsystem drivers.

    (asias: Drop unnecessary comparsion operators)

    Reported-by: majianpeng
    Cc: majianpeng
    Cc: Christoph Hellwig
    Cc: Jens Axboe
    Cc: James Bottomley
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Some target drivers might need to access the inquiry data
    directly, without sending out the actual command.
    So export these functions.

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

    Hannes Reinecke
     

30 Jan, 2013

2 commits

  • This patch fixes a regression introduced in v3.8-rc1 code where
    a zero-length MODE_SENSE was no longer returning GOOD status, but
    instead returning TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE to generate
    a CHECK_CONDITION status.

    This regression was introduced with the following commit:

    commit de103c93aff0bed0ae984274e5dc8b95899badab
    Author: Christoph Hellwig
    Date: Tue Nov 6 12:24:09 2012 -0800

    target: pass sense_reason as a return value

    and this patch has been tested with the following zero-length CDB:

    sg_raw /dev/sdd 5a 00 0a 00 00 00 00 00 00 00
    SCSI Status: Good

    Sense Information:
    sense buffer empty

    Cc: Christoph Hellwig
    Cc: Paolo Bonzini
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes a minor regression introduced in v3.8-rc1 code
    where a zero-length INQUIRY was no longer returning the correct
    INVALID FIELD IN CDB additional sense code.

    This regression was introduced with the following commit:

    commit de103c93aff0bed0ae984274e5dc8b95899badab
    Author: Christoph Hellwig
    Date: Tue Nov 6 12:24:09 2012 -0800

    target: pass sense_reason as a return value

    and this patch has been tested with the following zero-length CDB:

    sg_raw /dev/sdd 12 00 83 00 00 00
    SCSI Status: Check Condition

    Sense Information:
    Fixed format, current; Sense key: Illegal Request
    Additional sense: Invalid field in cdb

    Cc: Christoph Hellwig
    Cc: Paolo Bonzini
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

28 Nov, 2012

1 commit


16 Nov, 2012

1 commit

  • This patch adds a new max_write_same_len device attribute for use with
    WRITE_SAME w/ UNMAP=0 backend emulation. This can be useful for
    lowering the default backend value (IBLOCK uses 0xFFFF).

    Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to
    report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during
    sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated
    WRITE_SAME w/ UNMAP=0 cases.

    (Robert: Move max_write_same_len check in sbc_setup_write_same() to
    check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases)

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Cc: Robert Elliott
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

07 Nov, 2012

11 commits

  • Pass the sense reason as an explicit return value from the I/O submission
    path instead of storing it in struct se_cmd and using negative return
    values. This cleans up a lot of the code pathes, and with the sparse
    annotations for the new sense_reason_t type allows for much better
    error checking.

    (nab: Convert spc_emulate_modesense + spc_emulate_modeselect to use
    sense_reason_t with Roland's MODE SELECT changes)

    Signed-off-by: Christoph Hellwig
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This patch fixes a new off-by-one bug in the hardcoded starting offset of
    spc_emulate_modesense() code that causes BLOCK DESCRIPTOR to be incorrectly
    written within the MEDIUM TYPE buffer area of the mode parameter header.

    According to spc4r30, Section 7.5.4, BLOCK DESCRIPTOR for MODE_SENSE_10
    starts at byte 3, and BLOCK_DESCRIPTOR for MODE_SENSE (6) starts at byte 2.

    (roland: add MODE DATA LENGTH + MEDIUM TYPE offset comment)

    Cc: Roland Dreier
    Cc: Christoph Hellwig
    Cc: Douglas Gilbert
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This is another thing that compliance tests try, and it's easy to
    implement on top of the MODE SENSE refactoring; since we don't claim
    to support any changeable values, all we need to do is check that
    the page contents sent by the initiator match what we would return.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • The Windows SCSI compliance test asks for this mode page, and it's
    easy to implement: we can just return all 0s to show we don't support
    any of these features.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • Convert spc_emulate_modesense() to use a table of mode pages, rather
    than a switch statement. This makes it possible to add more pages
    sanely -- in particular we no longer need to make sure we keep the
    0x3f (return all mode pages) case in sync.

    While we're touching this code, make our MODE SENSE emulation a bit
    better in a couple of ways:
    - When the initiator passes PC == 1 asking for changeable values,
    return all 0s to show we don't support setting anything.
    - Return a block descriptor for disk devices.

    (nab: fix up device attribute references to use dev->dev_attrib
    in for-next code)

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • Now that the reservations and ALUA code have been cleaned up there is no need
    for the get_device_rev method, as we only need the standards revision in the
    inquiry data, where we can hardcode it.

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

    Christoph Hellwig
     
  • We always support ALUA for virtual backends, and never for physical ones. Simplify
    the code to just deal with these two cases and remove the superflous abstractions.

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

    Christoph Hellwig
     
  • We do not support host-level reservations for the pscsi backend, and all
    virtual backends are newere than SCSI-2, so just make the combined
    SPC-3 + SCSI-2 support the only supported variant and kill the switches
    for the different implementations, given that this code handles the no-op
    version just fine.

    (hch: Update DRF_SPC2_RESERVATIONS lock usage)

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • We can just key off ordered tag emulation of the transport_type field.

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

    Christoph Hellwig
     
  • No need to indirect through spc_parse_cdb if we only ever call it for
    REPORT LUNS emulation.

    (nab: Add missing EXPORT_SYMBOL for spc_emulate_report_luns)

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

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

    Christoph Hellwig