1. 15 5月, 2015 2 次提交
  2. 16 4月, 2015 1 次提交
  3. 15 4月, 2015 4 次提交
  4. 08 4月, 2015 5 次提交
  5. 27 3月, 2015 1 次提交
  6. 20 3月, 2015 1 次提交
  7. 07 3月, 2015 1 次提交
    • N
      target: Add target_show_dynamic_sessions attribute helper · f8e471f9
      Nicholas Bellinger 提交于
      This patch adds a new helper function that can be used by fabric driver
      TPG attributes for dumping the list of active sessions with a dynamically
      generated se_node_acl. (generate_node_acl=1).
      
      It prints one se_node_acl->initiatorname per line, up to PAGE_SIZE which
      is due to the current limitiation of single page attribute output within
      sysfs and configfs code.
      
      Note that if a session is referencing a explicit NodeACL, the InitiatorName
      will not appear within dynamic_sessions output.
      Reported-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f8e471f9
  8. 04 12月, 2014 1 次提交
  9. 29 10月, 2014 1 次提交
  10. 04 10月, 2014 1 次提交
    • A
      target: Add a user-passthrough backstore · 7c9e7a6f
      Andy Grover 提交于
      Add a LIO storage engine that presents commands to userspace for execution.
      This would allow more complex backstores to be implemented out-of-kernel,
      and also make experimentation a-la FUSE (but at the SCSI level -- "SUSE"?)
      possible.
      
      It uses a mmap()able UIO device per LUN to share a command ring and data
      area. The commands are raw SCSI CDBs and iovs for in/out data. The command
      ring is also reused for returning scsi command status and optional sense
      data.
      
      This implementation is based on Shaohua Li's earlier version but heavily
      modified. Differences include:
      
      * Shared memory allocated by kernel, not locked-down user pages
      * Single ring for command request and response
      * Offsets instead of embedded pointers
      * Generic SCSI CDB passthrough instead of per-cmd specialization in ring
        format.
      * Uses UIO device instead of anon_file passed in mailbox.
      * Optional in-kernel handling of some commands.
      
      The main reason for these differences is to permit greater resiliency
      if the user process dies or hangs.
      
      Things not yet implemented (on purpose):
      
      * Zero copy. The data area is flexible enough to allow page flipping or
        backend-allocated pages to be used by fabrics, but it's not clear these
        are performance wins. Can come later.
      * Out-of-order command completion by userspace. Possible to add by just
        allowing userspace to change cmd_id in rsp cmd entries, but currently
        not supported.
      * No locks between kernel cmd submission and completion routines. Sounds
        like it's possible, but this can come later.
      * Sparse allocation of mmaped area. Current code vmallocs the whole thing.
        If the mapped area was larger and not fully mapped then the driver would
        have more freedom to change cmd and data area sizes based on demand.
      
      Current code open issues:
      
      * The use of idrs may be overkill -- we maybe can replace them with a
        simple counter to generate cmd_ids, and a hash table to get a cmd_id's
        associated pointer.
      * Use of a free-running counter for cmd ring instead of explicit modulo
        math. This would require power-of-2 cmd ring size.
      
      (Add kconfig depends NET - Randy)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7c9e7a6f
  11. 02 10月, 2014 3 次提交
    • Q
      target: Fix queue full status NULL pointer for SCF_TRANSPORT_TASK_SENSE · 082f58ac
      Quinn Tran 提交于
      During temporary resource starvation at lower transport layer, command
      is placed on queue full retry path, which expose this problem.  The TCM
      queue full handling of SCF_TRANSPORT_TASK_SENSE currently sends the same
      cmd twice to lower layer.  The 1st time led to cmd normal free path.
      The 2nd time cause Null pointer access.
      
      This regression bug was originally introduced v3.1-rc code in the
      following commit:
      
      commit e057f533
      Author: Christoph Hellwig <hch@infradead.org>
      Date:   Mon Oct 17 13:56:41 2011 -0400
      
          target: remove the transport_qf_callback se_cmd callback
      Signed-off-by: NQuinn Tran <quinn.tran@qlogic.com>
      Signed-off-by: NSaurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      082f58ac
    • 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
    • J
      target: remove some smp_mb__after_atomic()s · 74ed7e62
      Joern Engel 提交于
      atomic_inc_return() already does an implicit memory barrier and the
      second case was moved from an atomic to a plain flag operation.  If a
      barrier were needed in the second case, it would have to be smp_mb(),
      not a variant optimized away for x86 and other architectures.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      74ed7e62
  12. 13 6月, 2014 1 次提交
    • N
      target: Fix NULL pointer dereference for XCOPY in target_put_sess_cmd · 0ed6e189
      Nicholas Bellinger 提交于
      This patch fixes a NULL pointer dereference regression bug that was
      introduced with:
      
      commit 1e1110c4
      Author: Mikulas Patocka <mpatocka@redhat.com>
      Date:   Sat May 17 06:49:22 2014 -0400
      
          target: fix memory leak on XCOPY
      
      Now that target_put_sess_cmd() -> kref_put_spinlock_irqsave() is
      called with a valid se_cmd->cmd_kref, a NULL pointer dereference
      is triggered because the XCOPY passthrough commands don't have
      an associated se_session pointer.
      
      To address this bug, go ahead and checking for a NULL se_sess pointer
      within target_put_sess_cmd(), and call se_cmd->se_tfo->release_cmd()
      to release the XCOPY's xcopy_pt_cmd memory.
      Reported-by: NThomas Glanzmann <thomas@glanzmann.de>
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org # 3.12+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0ed6e189
  13. 12 6月, 2014 1 次提交
  14. 10 6月, 2014 2 次提交
    • N
      target: Use complete_all for se_cmd->t_transport_stop_comp · a95d6511
      Nicholas Bellinger 提交于
      This patch fixes a bug where multiple waiters on ->t_transport_stop_comp
      occurs due to a concurrent ABORT_TASK and session reset both invoking
      transport_wait_for_tasks(), while waiting for the associated se_cmd
      descriptor backend processing to complete.
      
      For this case, complete_all() should be invoked in order to wake up
      both waiters in core_tmr_abort_task() + transport_generic_free_cmd()
      process contexts.
      
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Charalampos Pournaris <charpour@gmail.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a95d6511
    • N
      target: Set CMD_T_ACTIVE bit for Task Management Requests · f15e9cd9
      Nicholas Bellinger 提交于
      This patch fixes a bug where se_cmd descriptors associated with a
      Task Management Request (TMR) where not setting CMD_T_ACTIVE before
      being dispatched into target_tmr_work() process context.
      
      This is required in order for transport_generic_free_cmd() ->
      transport_wait_for_tasks() to wait on se_cmd->t_transport_stop_comp
      if a session reset event occurs while an ABORT_TASK is outstanding
      waiting for another I/O to complete.
      
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Charalampos Pournaris <charpour@gmail.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f15e9cd9
  15. 07 6月, 2014 1 次提交
  16. 18 5月, 2014 1 次提交
    • M
      target: fix memory leak on XCOPY · 1e1110c4
      Mikulas Patocka 提交于
      On each processed XCOPY command, two "kmalloc-512" memory objects are
      leaked. These represent two allocations of struct xcopy_pt_cmd in
      target_core_xcopy.c.
      
      The reason for the memory leak is that the cmd_kref field is not
      initialized (thus, it is zero because the allocations were done with
      kzalloc). When we decrement zero kref in target_put_sess_cmd, the result
      is not zero, thus target_release_cmd_kref is not called.
      
      This patch fixes the bug by moving kref initialization from
      target_get_sess_cmd to transport_init_se_cmd (this function is called from
      target_core_xcopy.c, so it will correctly initialize cmd_kref). It can be
      easily verified that all code that calls target_get_sess_cmd also calls
      transport_init_se_cmd earlier, thus moving kref_init shouldn't introduce
      any new problems.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org	# 3.12+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1e1110c4
  17. 18 4月, 2014 1 次提交
  18. 07 4月, 2014 6 次提交
    • N
      target: Enable READ_STRIP emulation in target_complete_ok_work · bc005869
      Nicholas Bellinger 提交于
      This patch enables the use of READ_STRIP software emulation in
      target_complete_ok_work() code for I/O READs.
      
      This is useful when the fabric does not support READ_STRIP hardware
      offload, but would still like to interact with backend device
      that have T10 PI enabled.
      
      v2 changes:
         - Move TARGET_PROT_DIN_STRIP check from target_check_read_strip()
           into target_complete_ok_work() (Sagi)
      
      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>
      bc005869
    • N
      target: Enable WRITE_INSERT emulation in target_execute_cmd · a84bf9ee
      Nicholas Bellinger 提交于
      This patch enables WRITE_INSERT emulation in target_execute_cmd()
      in order to locally generate DIF PI before submitting the WRITE
      to the underlying backend device.
      
      This is required for fabric drivers that currently don't support
      DIF over-the-wire, in order to inact with backend devices that
      have hardware (IBLOCK) or software (FILEIO + RAMDISK) support
      for handling T10 PI.
      
      v2 changes:
         - Convert to sbc_dif_generate() usage (Sagi)
      Reviewed-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.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>
      a84bf9ee
    • 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
    • N
      target: Add TFO->abort_task for aborted task resources release · 131e6abc
      Nicholas Bellinger 提交于
      Now that TASK_ABORTED status is not generated for all cases by
      TMR ABORT_TASK + LUN_RESET, a new TFO->abort_task() caller is
      necessary in order to give fabric drivers a chance to unmap
      hardware / software resources before the se_cmd descriptor is
      released via the normal TFO->release_cmd() codepath.
      
      This patch adds TFO->aborted_task() in core_tmr_abort_task()
      in place of the original transport_send_task_abort(), and
      also updates all fabric drivers to implement this caller.
      
      The fabric drivers that include changes to perform cleanup
      via ->aborted_task() are:
      
        - iscsi-target
        - iser-target
        - srpt
        - tcm_qla2xxx
      
      The fabric drivers that currently set ->aborted_task() to
      NOPs are:
      
        - loopback
        - tcm_fc
        - usb-gadget
        - sbp-target
        - vhost-scsi
      
      For the latter five, there appears to be no additional cleanup
      required before invoking TFO->release_cmd() to release the
      se_cmd descriptor.
      
      v2 changes:
        - Move ->aborted_task() call into transport_cmd_finish_abort (Alex)
      
      Cc: Alex Leung <amleung21@yahoo.com>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Vu Pham <vu@mellanox.com>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      131e6abc
    • 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/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
  19. 14 3月, 2014 2 次提交
  20. 24 2月, 2014 1 次提交
    • N
      target: Add DIF sense codes in transport_generic_request_failure · 94387aa7
      Nicholas Bellinger 提交于
      This patch adds the three missing DIF related sense codes within
      transport_generic_request_failure(), which are required to ensure
      that the correct ASC/ASQC is generated by the subsequent call to
      transport_send_check_condition_and_sense().
      
      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>
      94387aa7
  21. 13 2月, 2014 1 次提交
  22. 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
  23. 25 1月, 2014 1 次提交