1. 16 4月, 2015 1 次提交
  2. 15 4月, 2015 3 次提交
    • B
      target: Remove the unused flag SCF_ACK_KREF · 054922bb
      Bart Van Assche 提交于
      The flag SCF_ACK_KREF is only set but never tested. Hence remove
      this flag.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      054922bb
    • N
      target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling · c8e63985
      Nicholas Bellinger 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org> # v3.12+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c8e63985
    • C
      target: simplify the target template registration API · 9ac8928e
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9ac8928e
  3. 08 4月, 2015 2 次提交
    • C
    • N
      target: Add protected fabric + unprotected device support · 38b57f82
      Nicholas Bellinger 提交于
      This patch adds a new target_core_fabric_ops callback for allowing fabric
      drivers to expose a TPG attribute for signaling when a T10-PI protected
      fabric wants to function with an un-protected device without T10-PI.
      
      This specifically is to allow LIO to perform WRITE_STRIP + READ_INSERT
      operations when functioning with non T10-PI enabled devices, seperate
      from any available hw offloads the fabric supports.
      
      This is done using a new se_sess->sess_prot_type that is set at fabric
      session creation time based upon the TPG attribute.  It currently cannot
      be changed for individual sessions after initial creation.
      
      Also, update existing target_core_sbc.c code to honor sess_prot_type when
      setting up cmd->prot_op + cmd->prot_type assignments.
      
      (Add unlikely and !! boolean conversion in sbc_check_prot - Sagi)
      
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Doug Gilbert <dgilbert@interlog.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      38b57f82
  4. 13 2月, 2015 1 次提交
    • N
      target: Fix PR_APTPL_BUF_LEN buffer size limitation · f161d4b4
      Nicholas Bellinger 提交于
      This patch addresses the original PR_APTPL_BUF_LEN = 8k limitiation
      for write-out of PR APTPL metadata that Martin has recently been
      running into.
      
      It changes core_scsi3_update_and_write_aptpl() to use vzalloc'ed
      memory instead of kzalloc, and increases the default hardcoded
      length to 256k.
      
      It also adds logic in core_scsi3_update_and_write_aptpl() to double
      the original length upon core_scsi3_update_aptpl_buf() failure, and
      retries until the vzalloc'ed buffer is large enough to accommodate
      the outgoing APTPL metadata.
      Reported-by: NMartin Svec <martin.svec@zoner.cz>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f161d4b4
  5. 10 1月, 2015 1 次提交
  6. 04 12月, 2014 1 次提交
  7. 04 10月, 2014 1 次提交
    • N
      target: Add force_pr_aptpl device attribute · 92404e60
      Nicholas Bellinger 提交于
      This patch adds a force_pr_aptpl device attribute used to force SPC-3 PR
      Activate Persistence across Target Power Loss (APTPL) operation.  This
      makes PR metadata write-out occur during state change regardless if new
      PERSISTENT_RESERVE_OUT CDBs have their APTPL feature bit set.
      
      This is useful during H/A failover in active/passive setups where all PR
      state is being re-created on a different node, driven by configfs backend
      device + export layout and pre-loaded $DEV/pr/res_aptpl_metadata.
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      92404e60
  8. 02 10月, 2014 1 次提交
    • J
      target: encapsulate smp_mb__after_atomic() · 33940d09
      Joern Engel 提交于
      The target code has a rather generous helping of smp_mb__after_atomic()
      throughout the code base.  Most atomic operations were followed by one
      and none were preceded by smp_mb__before_atomic(), nor accompanied by a
      comment explaining the need for a barrier.
      
      Instead of trying to prove for every case whether or not it is needed,
      this patch introduces atomic_inc_mb() and atomic_dec_mb(), which
      explicitly include the memory barriers before and after the atomic
      operation.  For now they are defined in a target header, although they
      could be of general use.
      
      Most of the existing atomic/mb combinations were replaced by the new
      helpers.  In a few cases the atomic was sandwiched in
      spin_lock/spin_unlock and I simply removed the barrier.
      
      I suspect that in most cases the correct conversion would have been to
      drop the barrier.  I also suspect that a few cases exist where a) the
      barrier was necessary and b) a second barrier before the atomic would
      have been necessary and got added by this patch.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      33940d09
  9. 07 4月, 2014 4 次提交
    • N
      target: Pass in transport supported PI at session initialization · e70beee7
      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 <martin.petersen@oracle.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e70beee7
    • A
      target: Fix Task Aborted Status (TAS) handling · 68259b5a
      Alex Leung 提交于
      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: NAlex Leung <amleung21@yahoo.com>
      Cc: Alex Leung <amleung21@yahoo.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      68259b5a
    • S
      Target/core: Remove prot_handover use for now · 48f5e7b3
      Sagi Grimberg 提交于
      This is not going to be supported soon - so drop it.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      48f5e7b3
    • S
      Target/dif: Introduce protection-passthough-only mode · b5b8e298
      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: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b5b8e298
  10. 14 3月, 2014 1 次提交
  11. 13 2月, 2014 1 次提交
  12. 30 1月, 2014 1 次提交
    • N
      target: Fix percpu_ref_put race in transport_lun_remove_cmd · 5259a06e
      Nicholas Bellinger 提交于
      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: NTommy Apel <tommyapeldk@gmail.com>
      Cc: Tommy Apel <tommyapeldk@gmail.com>
      Cc: <stable@vger.kernel.org> #3.13+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5259a06e
  13. 25 1月, 2014 1 次提交
  14. 18 1月, 2014 2 次提交
    • N
      target: Add DIF CHECK_CONDITION ASC/ASCQ exception cases · fcc4f17b
      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 <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fcc4f17b
    • N
      target: Add DIF related base definitions · ce65e5b9
      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 <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ce65e5b9
  15. 10 1月, 2014 2 次提交
  16. 19 12月, 2013 1 次提交
  17. 18 12月, 2013 4 次提交
  18. 17 12月, 2013 1 次提交
  19. 12 12月, 2013 1 次提交
  20. 21 11月, 2013 2 次提交
  21. 14 11月, 2013 1 次提交
  22. 09 11月, 2013 1 次提交
  23. 08 11月, 2013 2 次提交
    • N
      target: Drop left-over se_lun->lun_cmd_list shutdown code · 4a9a6c8d
      Nicholas Bellinger 提交于
      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 <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4a9a6c8d
    • N
      target: Add percpu refcounting for se_lun access · 5277797d
      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 <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5277797d
  24. 17 10月, 2013 1 次提交
  25. 11 9月, 2013 3 次提交
    • N
      target/iscsi: Bump versions to v4.1.0 · 2999ee7f
      Nicholas Bellinger 提交于
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2999ee7f
    • 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: 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