1. 07 11月, 2012 1 次提交
    • C
      target: pass sense_reason as a return value · de103c93
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      de103c93
  2. 03 10月, 2012 1 次提交
    • N
      tcm_vhost: Convert I/O path to use target_submit_cmd_map_sgls · 9f0abc15
      Nicholas Bellinger 提交于
      This patch converts tcm_vhost to use target_submit_cmd_map_sgls() for
      I/O submission and mapping of pre-allocated SGL memory from incoming
      virtio-scsi SGL memory -> se_cmd descriptors.
      
      This includes removing the original open-coded fabric uses of target
      core callers to support transport_generic_map_mem_to_cmd() between
      target_setup_cmd_from_cdb() and transport_handle_cdb_direct() logic.
      
      It also includes adding a handful of new tcm_vhost_cmnd member +
      assignments in vhost_scsi_allocate_cmd() used from cmwq process
      context I/O submission within tcm_vhost_submission_work()
      
      (v2: Use renamed target_submit_cmd_map_sgls)
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9f0abc15
  3. 18 9月, 2012 2 次提交
  4. 21 8月, 2012 1 次提交
    • M
      tcm_vhost: Fix vhost_scsi_target structure alignment · 6de7145c
      Michael S. Tsirkin 提交于
      Here TRANSPORT_IQN_LEN is 224, which is a multiple of 4.
      Since vhost_tpgt is 2 bytes and abi_version is 4, the total size would
      be 230.  But gcc needs struct size be aligned to first field size, which
      is 4 bytes, so it pads the structure by extra 2 bytes to the total of
      232.
      
      This padding is very undesirable in an ABI:
      - it can not be initialized easily
      - it can not be checked easily
      - it can leak information between kernel and userspace
      
      Simplest solution is probably just to make the padding
      explicit.
      
      (v2: Add check for zero'ed backend->reserved field for VHOST_SCSI_SET_ENDPOINT
           and VHOST_SCSI_CLEAR_ENDPOINT ops as requested by MST)
      Reported-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6de7145c
  5. 17 8月, 2012 2 次提交
    • N
      tcm_vhost: Post-merge review changes requested by MST · 101998f6
      Nicholas Bellinger 提交于
      This patch contains the post RFC-v5 (post-merge) changes, this includes:
      
      - Add locking comment
      - Move vhost_scsi_complete_cmd ahead of TFO callbacks in order to
        drop forward declarations
      - Drop extra '!= NULL' usage in vhost_scsi_complete_cmd_work()
      - Change vhost_scsi_*_handle_kick() to use pr_debug
      - Fix possible race in vhost_scsi_set_endpoint() for vs->vs_tpg checking
        + assignment.
      - Convert tv_tpg->tpg_vhost_count + ->tv_tpg_port_count from atomic_t ->
        int, and make sure reference is protected by ->tv_tpg_mutex.
      - Drop unnecessary vhost_scsi->vhost_ref_cnt
      - Add 'err:' label for exception path in vhost_scsi_clear_endpoint()
      - Add enum for VQ numbers, add usage in vhost_scsi_open()
      - Add vhost_scsi_flush() + vhost_scsi_flush_vq() following
        drivers/vhost/net.c
      - Add smp_wmb() + vhost_scsi_flush() call during vhost_scsi_set_features()
      - Drop unnecessary copy_from_user() usage with GET_ABI_VERSION ioctl
      - Add missing vhost_scsi_compat_ioctl() caller for vhost_scsi_fops
      - Fix function parameter definition first line to follow existing
        vhost code style
      - Change 'vHost' usage -> 'vhost' in handful of locations
      - Change -EPERM -> -EBUSY usage for two failures in tcm_vhost_drop_nexus()
      - Add comment for tcm_vhost_workqueue in tcm_vhost_init()
      - Make GET_ABI_VERSION return 'int' + add comment in tcm_vhost.h
      Reported-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Anthony Liguori <aliguori@us.ibm.com>
      Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      101998f6
    • F
      tcm_vhost: Fix incorrect IS_ERR() usage in vhost_scsi_map_iov_to_sgl · f0e0e9bb
      Fengguang Wu 提交于
      Fix up a new coccinelle warnings reported by Fengguang Wu + Intel
      0-DAY kernel build testing backend:
      
      drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line
      533 returns NULL not ERR_PTR on failure
      
      vim +537 drivers/vhost/tcm_vhost.c
         534          if (!sg)
         535                  return -ENOMEM;
         536          pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
       > 537                 sg, sgl_count, IS_ERR(sg));
         538          sg_init_table(sg, sgl_count);
         539
         540          tv_cmd->tvc_sgl = sg;
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f0e0e9bb
  6. 30 7月, 2012 1 次提交
    • N
      tcm_vhost: Initial merge for vhost level target fabric driver · 057cbf49
      Nicholas Bellinger 提交于
      This patch adds the initial code for tcm_vhost, a Vhost level TCM
      fabric driver for virtio SCSI initiators into KVM guest.
      
      This code is currently up and running on v3.5-rc2 host+guest
      from target-pending/for-next-merge.
      
      Using tcm_vhost requires Zhi's -> Stefan -> nab's qemu vhost-scsi tree here:
      
        http://git.kernel.org/?p=virt/kvm/nab/qemu-kvm.git;a=shortlog;h=refs/heads/vhost-scsi
      
      --
      
      Changelog v4 -> v5:
      
        Expose ABI version via VHOST_SCSI_GET_ABI_VERSION + use Rev 0 as
        starting point for v3.6-rc code (Stefan + ALiguori + nab)
        Convert vhost_scsi_handle_vq() to vq_err() (nab + MST)
        Minor style fixes from checkpatch (nab)
      
      Changelog v3 -> v4:
      
        Rename vhost_vring_target -> vhost_scsi_target (mst + nab)
        Use TRANSPORT_IQN_LEN in vhost_scsi_target->vhost_wwpn[] def (nab)
        Move back to drivers/vhost/, and just use drivers/vhost/Kconfig.tcm (mst)
        Move TCM_VHOST related ioctl defines from include/linux/vhost.h ->
        drivers/vhost/tcm_vhost.h as requested by MST (nab)
        Move Kbuild.tcm include from drivers/staging -> drivers/vhost/, and
        just use 'if STAGING' around 'source drivers/vhost/Kbuild.tcm'
      
      Changelog v2 -> v3:
      
        Unlock on error in tcm_vhost_drop_nexus() (DanC)
        Fix strlen() doesn't count the terminator (DanC)
        Call kfree() on an error path (DanC)
        Convert tcm_vhost_write_pending to use target_execute_cmd (hch + nab)
        Fix another strlen() off by one in tcm_vhost_make_tport (DanC)
        Add option under drivers/staging/Kconfig, and move to drivers/vhost/tcm/
        as requested by MST (nab)
      
      Changelog v1 -> v2:
      
        Fix tv_cmd completion -> release SGL memory leak (nab)
        Fix sparse warnings for static variable usage ((Fengguang Wu)
        Fix sparse warnings for min() typing + printk format specs (Fengguang Wu)
        Convert to cmwq submission for I/O dispatch (nab + hch)
      
      Changelog v0 -> v1:
      
        Merge into single source + header file, and move to drivers/vhost/
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Anthony Liguori <aliguori@us.ibm.com>
      Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      057cbf49