1. 20 Apr, 2015 1 commit
    • Andy Grover's avatar
      target: Version 2 of TCMU ABI · 0ad46af8
      Andy Grover authored
      The initial version of TCMU (in 3.18) does not properly handle
      bidirectional SCSI commands -- those with both an in and out buffer. In
      looking to fix this it also became clear that TCMU's support for adding
      new types of entries (opcodes) to the command ring was broken. We need
      to fix this now, so that future issues can be handled properly by adding
      new opcodes.
      
      We make the most of this ABI break by enabling bidi cmd handling within
      TCMP_OP_CMD opcode. Add an iov_bidi_cnt field to tcmu_cmd_entry.req.
      This enables TCMU to describe bidi commands, but further kernel work is
      needed for full bidi support.
      
      Enlarge tcmu_cmd_entry_hdr by 32 bits by pulling in cmd_id and __pad1. Turn
      __pad1 into two 8 bit flags fields, for kernel-set and userspace-set flags,
      "kflags" and "uflags" respectively.
      
      Update version fields so userspace can tell the interface is changed.
      
      Update tcmu-design.txt with details of how new stuff works:
      - Specify an additional requirement for userspace to set UNKNOWN_OP
        (bit 0) in hdr.uflags for unknown/unhandled opcodes.
      - Define how Data-In and Data-Out fields are described in req.iov[]
      
      Changed in v2:
      - Change name of SKIPPED bit to UNKNOWN bit
      - PAD op does not set the bit any more
      - Change len_op helper functions to take just len_op, not the whole struct
      - Change version to 2 in missed spots, and use defines
      - Add 16 unused bytes to cmd_entry.req, in case additional SAM cmd
        parameters need to be included
      - Add iov_dif_cnt field to specify buffers used for DIF info in iov[]
      - Rearrange fields to naturally align cdb_off
      - Handle if userspace sets UNKNOWN_OP by indicating failure of the cmd
      - Wrap some overly long UPDATE_HEAD lines
      
      (Add missing req.iov_bidi_cnt + req.iov_dif_cnt zeroing - Ilias)
      Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
      Reviewed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      0ad46af8
  2. 16 Apr, 2015 9 commits
  3. 14 Apr, 2015 5 commits
    • Akinobu Mita's avatar
      target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_* · bfd9a53e
      Akinobu Mita authored
      The scatterlist for protection information which is passed to
      sbc_dif_verify_read() or sbc_dif_verify_write() requires that
      neighboring scatterlist entries are contiguous or chained so that they
      can be iterated by sg_next().
      
      However, the protection information for RD-MCP backends could be located
      in the multiple scatterlist arrays when the ramdisk space is too large.
      So if the read/write request straddles this boundary, sbc_dif_verify_read()
      or sbc_dif_verify_write() can't iterate all scatterlist entries.
      
      This problem can be fixed by chaining protection information scatterlist
      at creation time.  For the architectures which don't support sg chaining
      (i.e. !CONFIG_ARCH_HAS_SG_CHAIN), fix it by allocating temporary
      scatterlist if needed.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: target-devel@vger.kernel.org
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      bfd9a53e
    • Bart Van Assche's avatar
      target: Remove the unused flag SCF_ACK_KREF · 054922bb
      Bart Van Assche authored
      The flag SCF_ACK_KREF is only set but never tested. Hence remove
      this flag.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      054922bb
    • Bart Van Assche's avatar
      target: Fix two sparse warnings · cb0df4d3
      Bart Van Assche authored
      Avoid that sparse complains about context imbalances.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      cb0df4d3
    • Nicholas Bellinger's avatar
      target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling · c8e63985
      Nicholas Bellinger authored
      This patch fixes a bug for COMPARE_AND_WRITE handling with
      fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
      
      It adds the missing allocation for cmd->t_bidi_data_sg within
      transport_generic_new_cmd() that is used by COMPARE_AND_WRITE
      for the initial READ payload, even if the fabric is already
      providing a pre-allocated buffer for cmd->t_data_sg.
      
      Also, fix zero-length COMPARE_AND_WRITE handling within the
      compare_and_write_callback() and target_complete_ok_work()
      to queue the response, skipping the initial READ.
      
      This fixes COMPARE_AND_WRITE emulation with loopback, vhost,
      and xen-backend fabric drivers using SG_TO_MEM_NOALLOC.
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org> # v3.12+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      c8e63985
    • Christoph Hellwig's avatar
      target: simplify the target template registration API · 9ac8928e
      Christoph Hellwig authored
      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 <bart.vanassche@sandisk.com>.
      
      (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: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      9ac8928e
  4. 08 Apr, 2015 25 commits