1. 11 9月, 2013 24 次提交
    • N
      target: Update copyright ownership/year information to 2013 · 4c76251e
      Nicholas Bellinger 提交于
      Update copyright ownership/year information for target-core,
      loopback, iscsi-target, tcm_qla2xx, vhost and iser-target.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4c76251e
    • N
      iscsi-target: Bump default TCP listen backlog to 256 · 837f6452
      Nicholas Bellinger 提交于
      This patch bumps the default TCP listen backlog within iscsit_setup_np()
      from 5 to 256, in order to reduce the overall latency caused by a small
      backlog with 100's of simultaneous login attempts directed to the same
      single network portal.
      
      Also add a ISCSIT_TCP_BACKLOG macro in iscsi_target_core.h.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      837f6452
    • G
      target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out · f730f915
      Gera Kazakov 提交于
      This patch fixes a >= v3.9+ regression in __core_scsi3_write_aptpl_to_file()
      + core_alua_write_tpg_metadata() write-out, where a return value of -EIO was
      incorrectly being returned upon success.
      
      This bug was originally introduced in:
      
      commit 0e9b10a9
      Author: Al Viro <viro@zeniv.linux.org.uk>
      Date:   Sat Feb 23 15:22:43 2013 -0500
      
          target: writev() on single-element vector is pointless
      
      However, given that the return of core_scsi3_update_and_write_aptpl()
      was not used to determine if a command should be returned with non GOOD
      status, this bug was not being triggered in PR logic until v3.11-rc1 by
      commit:
      
      commit 459f213b
      Author: Andy Grover <agrover@redhat.com>
      Date:   Thu May 16 10:41:02 2013 -0700
      
          target: Allocate aptpl_buf inside update_and_write_aptpl()
      
      So, go ahead and only return -EIO if kernel_write() returned a
      negative value.
      Reported-by: NGera Kazakov <gkazakov@msn.com>
      Signed-off-by: NGera Kazakov <gkazakov@msn.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@vger.kernel.org # 3.9+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f730f915
    • N
      iscsi-target; Bump default CmdSN Depth to 64 · 38f7d6ed
      Nicholas Bellinger 提交于
      This patch bumps the default TA_DEFAULT_CMDSN_DEPTH from 16 -> 64,
      which is closer to a sane default for larger pipes @ 10 Gb/sec
      with traditional iSCSI, or @ 40/56 Gb/sec Ethernet/Infiniband with
      iSCSI Extentions for RDMA.
      
      There is really no downside to increasing this default value for
      1 Gb/sec.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      38f7d6ed
    • N
      iscsi-target: Remove unnecessary wait_for_completion in iscsi_get_thread_set · 12e4101a
      Nicholas Bellinger 提交于
      This patch removes an unnecessary wait_for_completion within
      iscsi_get_thread_set(), that would wait for 1 second before
      trying to obtain an inactive struct iscsi_thread_set from
      iscsi_get_ts_from_inactive_list().
      
      Since iscsi_allocate_thread_sets() will already be adding the
      newly allocated iscsi_thread_set to the inactive list directly,
      there is no need to wait here.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      12e4101a
    • N
      iscsi-target: Add thread_set->ts_activate_sem + use common deallocate · 5ab41ca4
      Nicholas Bellinger 提交于
      This patch removes the iscsi_thread_set->[rx,tx]_post_start_comp that
      was originally used synchronize startup between rx and tx threads within
      a single thread_set.
      
      Instead, use a single ->ts_activate_sem in iscsi_activate_thread_set()
      to wait for both processes to awake in the RX/TX pre handlers.
      
      Also, go ahead and refactor thread_set deallocate code into a common
      iscsi_deallocate_thread_one(), and update iscsi_deallocate_thread_sets()
      and iscsi_deallocate_extra_thread_sets() use this code
      
      v3 changes:
        - Make iscsi_deallocate_thread_one defined as static (Fengguang)
      
      v2 changes:
        - Set ISCSI_THREAD_SET_ACTIVE before calling complete in
          iscsi_activate_thread_set
        - Protect ts->conn sanity checks with ->ts_state_lock in
          RX/TX pre handlers
        - Add ->ts_activate_sem to save extra context switches per
          iscsi_activate_thread_set() call.
        - Refactor thread_set shutdown into iscsi_deallocate_thread_one()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5ab41ca4
    • N
      iscsi-target: Fix race with thread_pre_handler flush_signals + ISCSI_THREAD_SET_DIE · d5705c4a
      Nicholas Bellinger 提交于
      This patch addresses an long standing race in iscsi_[rx,tx]_thread_pre_handler()
      use of flush_signals(), and between iscsi_deallocate_extra_thread_sets() setting
      ISCSI_THREAD_SET_DIE before calling kthread_stop().
      
      It addresses the issue by both holding ts_state_lock before calling send_sig()
      in iscsi_deallocate_extra_thread_sets(), as well as only calling flush_signals()
      when ts->status != ISCSI_THREAD_SET_DIE within iscsi_[rx,tx]_thread_pre_handler()
      code.
      
      v2 changes:
        - Add explicit complete(&ts->[rx,tx]_start_comp); before kthread_stop() in
          iscsi_deallocate_extra_thread_sets()
        - Drop left-over send_sig() calls in iscsi_deallocate_extra_thread_sets()
        - Add kthread_should_stop() check in iscsi_signal_thread_pre_handler()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d5705c4a
    • W
      target: remove unused including <linux/version.h> · 0105c257
      Wei Yongjun 提交于
      Remove including <linux/version.h> that don't need it.
      Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0105c257
    • V
      iser-target: introduce fast memory registration mode (FRWR) · 59464ef4
      Vu Pham 提交于
      This model was introduced in 00f7ec36 "RDMA/core: Add memory
      management extensions support" and works when the IB device
      supports the IB_DEVICE_MEM_MGT_EXTENSIONS capability.
      
      Upon creating the isert device, ib_isert will test whether the HCA
      supports FRWR. If supported then set the flag and assign
      function pointers that handle fast registration and deregistration
      of appropriate resources (fast_reg descriptors).
      
      When new connection coming in, ib_isert will check frwr flag and
      create frwr resouces, if fail to do it will switch back to
      old model of using global dma key and turn off the frwr support.
      
      Registration is done using posting IB_WR_FAST_REG_MR to the QP and
      invalidations using posting IB_WR_LOCAL_INV.
      Signed-off-by: NVu Pham <vu@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      59464ef4
    • V
      iser-target: generalize rdma memory registration and cleanup · d40945d8
      Vu Pham 提交于
      Current driver uses global dma key to register the memory pointed
      by sg list provided by the target core.
      
      This is the preparation step for adding more methods like fast
      path memory registration, make the reg/unreg calls be function
      pointers.
      Signed-off-by: NVu Pham <vu@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d40945d8
    • V
      iser-target: move rdma wr processing to a shared function · 90ecc6e2
      Vu Pham 提交于
      isert_put_datain() and isert_get_dataout() share a lot of code
      in rdma wr processing, move this common code to a shared function.
      
      Use isert_unmap_cmd to cleanup for RDMA_READ completion.
      Remove duplicate field in isert_cmd and isert_rdma_wr structs
      Change misc debug messages to track isert_cmd
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NVu Pham <vu@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      90ecc6e2
    • N
      target: Enable global EXTENDED_COPY setup/release · f99715ac
      Nicholas Bellinger 提交于
      Add calls to target_xcopy_setup_pt() + target_xcopy_release_pt() to
      target_core_init_configfs() and target_core_exit_configfs()
      respectively.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      f99715ac
    • N
      target: Add Third Party Copy (3PC) bit in INQUIRY response · d397a445
      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 <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d397a445
    • N
      target: Enable EXTENDED_COPY setup in spc_parse_cdb · 04b1b795
      Nicholas Bellinger 提交于
      Setup up the se_cmd->execute_cmd() pointers for EXTENDED_COPY and
      RECEIVE_COPY_RESULTS handling within spc_parse_cdb()
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      04b1b795
    • N
      target: Add support for EXTENDED_COPY copy offload emulation · cbf031f4
      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 <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      cbf031f4
    • N
      target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check · 89c12cc9
      Nicholas Bellinger 提交于
      This patch adds an check for a non-existent port->sep_alua_tg_pt_gp_mem
      within target_alua_state_check(), which is not present for internally
      dispatched EXTENDED_COPY WRITE I/O to the destination target port.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      89c12cc9
    • N
      target: Add global device list for EXTENDED_COPY · d9ea32bf
      Nicholas Bellinger 提交于
      EXTENDED_COPY needs to be able to search a global list of devices
      based on NAA WWN device identifiers, so add a simple g_device_list
      protected by g_device_mutex.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d9ea32bf
    • N
      target: Make helpers non static for EXTENDED_COPY command setup · c5ff8d6b
      Nicholas Bellinger 提交于
      Both target_alloc_sgl() and transport_generic_map_mem_to_cmd() are
      required by EXTENDED_COPY logic when setting up internally dispatched
      command descriptors, so go ahead and make both of these non static.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      c5ff8d6b
    • N
      target: Make spc_parse_naa_6h_vendor_specific non static · 68366026
      Nicholas Bellinger 提交于
      This patch makes spc_parse_naa_6h_vendor_specific() available to
      other target code, which is required by EXTENDED_COPY when comparing
      the received NAA WWN device identifer for locating the associated
      se_device backend.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      68366026
    • N
      target: Make target_core_subsystem defined as non static · 56d128fa
      Nicholas Bellinger 提交于
      This patch makes the top-level target_core_subsystem array available
      to other target code, which is required by EXTENDED_COPY to pin the
      backend se_device using configfs_depend_item(), in order to ensure
      it can't be removed for the duration of a EXTENDED_COPY operation.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      56d128fa
    • N
      target/tcm_qla2xxx: Add/use target_reverse_dma_direction() in target_core_fabric.h · b3faa2e8
      Nicholas Bellinger 提交于
      Reversing the dma_data_direction for pci_map_sg() friends is useful
      for other drivers, so move it from tcm_qla2xxx into inline code
      within target_core_fabric.h.
      
      Also drop internal usage of equivlient in tcm_qla2xxx fabric code.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      b3faa2e8
    • N
      target: Release COMPARE_AND_WRITE mutex in generic failure path · cf6d1f09
      Nicholas Bellinger 提交于
      This patch adds a extra check for SCF_COMPARE_AND_WRITE within
      transport_generic_request_failure() to invoke the callback for
      compare_and_write_callback() or compare_and_write_done(), in
      order to release se_dev->caw_mutex from the generic failure
      path.
      
      It also adds to checks within compare_and_write_callback() to
      avoid processing when transport_generic_request_failure() occurs
      early enough that cmd->t_data_sg or cmd->t_bidi_data_sg have not
      been setup yet, nor se_dev->caw_mutex obtained from within
      sbc_compare_and_write().
      
      v4 changes:
       - Add explicit check for cmd->transport_complete_callback in
         transport_generic_request_failure() to handle case where
         sbc_compare_and_write()clears callback pointer (Dan Carpenter)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      cf6d1f09
    • N
      target: Add compare_and_write_post() completion callback fall through · a2890087
      Nicholas Bellinger 提交于
      This patch changes target_complete_ok_work() to fall through
      after calling the se_cmd->transport_complete_callback() ->
      compare_and_write_post() callback, by keying off the existance
      of SCF_COMPARE_AND_WRITE_POST.
      
      This is necessary because once SCF_COMPARE_AND_WRITE_POST has
      been set by compare_and_write_post(), the SCSI response needs
      to be sent via TFO->queue_status().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a2890087
    • N
      target: Add support for COMPARE_AND_WRITE emulation · 68ff9b9b
      Nicholas Bellinger 提交于
      This patch adds support for COMPARE_AND_WRITE emulation on a per block
      basis.  This logic is used as an atomic test and set primative currently
      used by VMWare ESX VAAI for performing array side locking of individual
      VMFS extent ownership.
      
      This includes the COMPARE_AND_WRITE CDB parsing within sbc_parse_cdb(),
      and does the majority of the work within the compare_and_write_callback()
      to perform the verify instance user data comparision, and subsequent
      write instance user data I/O submission upon a successfull comparision.
      
      The synchronization is enforced by se_device->caw_sem, that is obtained
      before the initial READ I/O submission in sbc_compare_and_write().  The
      mutex is then released upon MISCOMPARE in compare_and_write_callback(),
      or upon WRITE instance user-data completion in compare_and_write_post().
      
      The implementation currently assumes a single logical block (NoLB=1).
      
      v4 changes:
       - Explicitly clear cmd->transport_complete_callback for two failure
         cases in sbc_compare_and_write() in order to avoid double unlock
         of ->caw_sem in compare_and_write_callback() (Dan Carpenter)
      
      v3 changes:
       - Convert se_device->caw_mutex to ->caw_sem
      
      v2 changes:
       - Set SCF_COMPARE_AND_WRITE and cmd->execute_cmd() to
         sbc_compare_and_write() during setup in sbc_parse_cdb()
       - Use sbc_compare_and_write() for initial READ submission with
         DMA_FROM_DEVICE
       - Reset cmd->execute_cmd() to sbc_execute_rw() for write instance
         user-data in compare_and_write_callback()
       - Drop SCF_BIDI command flag usage
       - Set TRANSPORT_PROCESSING + transport_state flags before write
         instance submission, and convert to __target_execute_cmd()
       - Prevent sbc_get_size() from being being called twice to
         generate incorrect size in sbc_parse_cdb()
       - Enforce se_device->caw_mutex synchronization between initial
         READ I/O submission, and final WRITE I/O completion.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      68ff9b9b
  2. 10 9月, 2013 16 次提交
    • N
      target: Add MAXIMUM COMPARE AND WRITE LENGTH in Block Limits VPD · 0123a9ec
      Nicholas Bellinger 提交于
      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 <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      0123a9ec
    • N
      target: Make __target_execute_cmd() available as extern · 76dde50e
      Nicholas Bellinger 提交于
      Required by COMPARE_AND_WRITE for write instance user-data
      submission, in order to bypass target_execute_cmd() checks.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      76dde50e
    • N
      target: Add transport_reset_sgl_orig() for COMPARE_AND_WRITE · 47e459e6
      Nicholas Bellinger 提交于
      After COMPARE_AND_WRITE completes it's comparision, the WRITE
      payload SGLs head expect to be updated to point from the verify
      instance of user data, to the write instance of user data.
      
      So for this special case, add transport_reset_sgl_orig() usage
      within transport_free_pages() and add se_cmd->t_data_[sg,nents]_orig
      members to save the original assignments.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      47e459e6
    • N
      target: Do memory allocation for bidi commands using target_alloc_sgl · 8cefe07b
      Nicholas Bellinger 提交于
      This patch updates transport_generic_new_cmd() to call target_alloc_sgl()
      for SGL + page memory allocation for se_cmd->t_bidi_data_sg.
      
      It also adds the special case for SCF_COMPARE_AND_WRITE to calculate a
      different bidi_length based upon se_cmd->t_task_nolb.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      8cefe07b
    • N
      target: Refactor transport_generic_get_mem to target_alloc_sgl · 20093994
      Nicholas Bellinger 提交于
      This patch refactors transport_generic_get_mem() to target_alloc_sgl()
      for accepting **sgl, *nents, length and zero_page as function parameters
      in order to be used for both se_cmd->t_data_sg + se_cmd->t_bidi_data_sg
      allocations.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      20093994
    • N
      target: Convert se_cmd->t_bidi_data_sg checks to use SCF_BIDI · 64577407
      Nicholas Bellinger 提交于
      Stop keying off se_cmd->t_bidi_data_sg within transport_complete_qf()
      + target_complete_ok_work(), and just use SCF_BIDI instead.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      64577407
    • N
      target: Allow sbc_ops->execute_rw() to accept SGLs + data_direction · a82a9538
      Nicholas Bellinger 提交于
      COMPARE_AND_WRITE expects to be able to send down a DMA_FROM_DEVICE
      to obtain the necessary READ payload for comparision against the
      first half of the WRITE payload containing the verify user data.
      
      Currently virtual backends expect to internally reference SGLs,
      SGL nents, and data_direction, so change IBLOCK, FILEIO and RD
      sbc_ops->execute_rw() to accept this values as function parameters.
      
      Also add default sbc_execute_rw() handler for the typical case for
      cmd->execute_rw() submission using cmd->t_data_sg, cmd->t_data_nents,
      and cmd->data_direction).
      
      v2 Changes:
        - Add SCF_COMPARE_AND_WRITE command flag
        - Use sbc_execute_rw() for normal cmd->execute_rw() submission
          with expected se_cmd members.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a82a9538
    • N
      target: Add TCM_MISCOMPARE_VERIFY sense handling · 818b571c
      Nicholas Bellinger 提交于
      This patch adds TCM_MISCOMPARE_VERIFY (ASC=0x1d, ASCQ=0x00) sense
      handling to transport_send_check_condition_and_sense(), which is
      required for a COMPARE_AND_WRITE comparision failure.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      818b571c
    • N
      target: Add return for se_cmd->transport_complete_callback · a6b0133c
      Nicholas Bellinger 提交于
      This patch adds a sense_reason_t return to ->transport_complete_callback(),
      and updates target_complete_ok_work() to invoke the call if necessary to
      transport_send_check_condition_and_sense() during the failure case.
      
      Also update xdreadwrite_callback() to use this return value.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a6b0133c
    • N
      scsi: Add CDB definition for COMPARE_AND_WRITE · 1c68cc16
      Nicholas Bellinger 提交于
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      1c68cc16
    • D
      target/pscsi: remove an unneeded check · fdb4c1f3
      Dan Carpenter 提交于
      blk_get_request() just returns NULL on error, it doesn't return an
      ERR_PTR.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fdb4c1f3
    • N
      iscsi-target: Convert to per-cpu ida_alloc + ida_free command map · 988e3a85
      Nicholas Bellinger 提交于
      This patch changes iscsi-target to use transport_alloc_session_tags()
      pre-allocation logic for per-cpu session tag pooling with internal
      ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id.
      
      This includes tag pool setup based upon per NodeACL queue_depth after
      locating se_node_acl in iscsi_target_locate_portal().
      
      Also update iscsit_allocate_cmd() and iscsit_release_cmd() to use
      percpu_ida_alloc() and percpu_ida_free() respectively.
      
      v5 changes;
        - Convert to percpu_ida.h include
      
      v2 changes:
        - Fix bug with SessionType=Discovery in iscsi_target_locate_portal()
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      988e3a85
    • N
      iscsi/iser-target: Convert to command priv_size usage · d703ce2f
      Nicholas Bellinger 提交于
      This command converts iscsi/isert-target to use allocations based on
      iscsit_transport->priv_size within iscsit_allocate_cmd(), instead of
      using an embedded isert_cmd->iscsi_cmd.
      
      This includes removing iscsit_transport->alloc_cmd() usage, along
      with updating isert-target code to use iscsit_priv_cmd().
      
      Also, remove left-over iscsit_transport->release_cmd() usage for
      direct calls to iscsit_release_cmd(), and drop the now unused
      lio_cmd_cache and isert_cmd_cache.
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d703ce2f
    • N
      vhost/scsi: Add pre-allocation for tv_cmd SGL + upages memory · 3aee26b4
      Nicholas Bellinger 提交于
      This patch adds support for pre-allocation of per tv_cmd descriptor
      scatterlist + user-space page pointer memory using se_sess->sess_cmd_map
      within tcm_vhost_make_nexus() code.
      
      This includes sanity checks within vhost_scsi_map_to_sgl()
      to reject I/O that exceeds these initial hardcoded values, and
      the necessary cleanup in tcm_vhost_make_nexus() failure path +
      tcm_vhost_drop_nexus().
      
      v3 changes:
        - Rebase to v3.11-rc5 code
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Reviewed-by: NAsias He <asias@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3aee26b4
    • N
      vhost/scsi: Convert to per-cpu ida_alloc + ida_free command map · 4824d3bf
      Nicholas Bellinger 提交于
      This patch changes vhost/scsi to use transport_init_session_tags()
      pre-allocation logic for per-cpu session tag pooling with internal
      ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id.
      
      FIXME: Make transport_init_session_tags() number of tags setup
      configurable per vring client setting via configfs
      
      v5 changes:
       - Convert to percpu_ida.h include
      
      v3 changes:
       - Update to percpu-ida usage
       - Rebase to v3.11-rc5 code
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4824d3bf
    • N
      target: Add transport_init_session_tags using per-cpu ida · c0add7fd
      Nicholas Bellinger 提交于
      This patch adds lib/idr.c based transport_init_session_tags() logic
      that allows fabric drivers to setup a per-cpu se_sess->sess_tag_pool
      and associated se_sess->sess_cmd_map for basic tagged pre-allocation
      of fabric descriptor sized memory.
      
      v5 changes:
        - Convert to percpu_ida.h include
      
      v4 changes:
        - Add transport_alloc_session_tags() for fabrics that need early
          transport_init_session()
      
      v3 changes:
        - Update to percpu-ida usage
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAsias He <asias@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c0add7fd