1. 10 May, 2016 1 commit
  2. 23 Jun, 2015 2 commits
  3. 17 Jun, 2015 1 commit
  4. 16 Jun, 2015 2 commits
  5. 02 Jun, 2015 1 commit
    • Bart Van Assche's avatar
      target: Minimize SCSI header #include directives · ba929992
      Bart Van Assche authored
      Only include SCSI initiator header files in target code that needs
      these header files, namely the SCSI pass-through code and the tcm_loop
      driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in
      target code because the former is intended for initiator code and the
      latter for target code. With this patch the only initiator include
      directives in target code that remain are as follows:
      
      $ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
      drivers/target/loopback/tcm_loop.c:29:#include <scsi/scsi.h>
      drivers/target/loopback/tcm_loop.c:31:#include <scsi/scsi_host.h>
      drivers/target/loopback/tcm_loop.c:32:#include <scsi/scsi_device.h>
      drivers/target/loopback/tcm_loop.c:33:#include <scsi/scsi_cmnd.h>
      drivers/target/target_core_pscsi.c:39:#include <scsi/scsi_device.h>
      drivers/target/target_core_pscsi.c:40:#include <scsi/scsi_host.h>
      drivers/xen/xen-scsiback.c:52:#include <scsi/scsi_host.h> /* SG_ALL */
      Signed-off-by: 's avatarBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: 's avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: 's avatarJames Bottomley <JBottomley@Odin.com>
      ba929992
  6. 01 Jun, 2015 4 commits
    • Nicholas Bellinger's avatar
      target: Drop se_lun->lun_active for existing percpu lun_ref · 9e37d042
      Nicholas Bellinger authored
      With se_port_t and t10_alua_tg_pt_gp_member being absored into se_lun,
      there is no need for an extra atomic_t based reference count for PR
      ALL_TG_PT=1 and ALUA access state transition.
      
      Go ahead and use the existing percpu se_lun->lun_ref instead, and
      convert the two special cases to percpu_ref_tryget_live() to avoid
      se_lun if transport_clear_lun_ref() has already been invoked to
      shutdown the se_lun.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Reviewed-by: 's avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      9e37d042
    • Nicholas Bellinger's avatar
      target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage · 4cc987ea
      Nicholas Bellinger authored
      With se_port and t10_alua_tg_pt_gp_member being absored into se_lun,
      there is no need for an extra lock to protect se_lun->lun_se_dev
      assignment.
      
      This patch also converts backend drivers to use call_rcu() release
      to allow any se_device readers to complete.  The call_rcu() instead
      of kfree_rcu() is required here because se_device is embedded into
      the backend driver specific structure.
      
      Also, convert se_lun->lun_stats to use atomic_long_t within the
      target_complete_ok_work() completion callback, and add FIXME for
      transport_lookup_tmr_lun() with se_lun->lun_ref.
      
      Finally, update sbp_update_unit_directory() special case usage with
      proper rcu_dereference_raw() and configfs symlink comment.
      Reported-by: 's avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: 's avatarHannes Reinecke <hare@suse.de>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Chris Boot <bootc@bootc.net>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      4cc987ea
    • Christoph Hellwig's avatar
      target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun · adf653f9
      Christoph Hellwig authored
      This patch eliminates all se_port + t10_alua_tg_pt_gp_member usage,
      and converts current users to direct se_lun pointer dereference.
      
      This includes the removal of core_export_port(), core_release_port()
      core_dev_export() and core_dev_unexport().  Along with conversion
      of special case se_lun pointer dereference within PR ALL_TG_PT=1
      and ALUA access state transition UNIT_ATTENTION handling.
      
      Also, update core_enable_device_list_for_node() to reference the
      new per se_lun->lun_deve_list when creating a new entry, or
      replacing an existing one via RCU.
      Signed-off-by: 's avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: 's avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      adf653f9
    • Nicholas Bellinger's avatar
      target: Convert se_node_acl->device_list[] to RCU hlist · 29a05dee
      Nicholas Bellinger authored
      This patch converts se_node_acl->device_list[] table for mappedluns
      to modern RCU hlist_head usage in order to support an arbitrary number
      of node_acl lun mappings.
      
      It converts transport_lookup_*_lun() fast-path code to use RCU read path
      primitives when looking up se_dev_entry.  It adds a new hlist_head at
      se_node_acl->lun_entry_hlist for this purpose.
      
      For transport_lookup_cmd_lun() code, it works with existing per-cpu
      se_lun->lun_ref when associating se_cmd with se_lun + se_device.
      Also, go ahead and update core_create_device_list_for_node() +
      core_free_device_list_for_node() to use ->lun_entry_hlist.
      
      It also converts se_dev_entry->pr_ref_count access to use modern
      struct kref counting, and updates core_disable_device_list_for_node()
      to kref_put() and block on se_deve->pr_comp waiting for outstanding PR
      special-case PR references to drop, then invoke kfree_rcu() to wait
      for the RCU grace period to complete before releasing memory.
      
      So now that se_node_acl->lun_entry_hlist fast path access uses RCU
      protected pointers, go ahead and convert remaining non-fast path
      RCU updater code using ->lun_entry_lock to struct mutex to allow
      callers to block while walking se_node_acl->lun_entry_hlist.
      
      Finally drop the left-over core_clear_initiator_node_from_tpg() that
      originally cleared lun_access during se_node_acl shutdown, as post
      RCU conversion it now becomes duplicated logic.
      Reviewed-by: 's avatarHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      29a05dee
  7. 30 May, 2015 2 commits
  8. 24 Nov, 2014 1 commit
  9. 01 Oct, 2014 1 commit
    • Joern Engel's avatar
      target: encapsulate smp_mb__after_atomic() · 33940d09
      Joern Engel authored
      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: 's avatarJoern Engel <joern@logfs.org>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      33940d09
  10. 06 Jun, 2014 1 commit
  11. 18 Apr, 2014 1 commit
  12. 13 Mar, 2014 1 commit
    • Paul Bolle's avatar
      target: silence GCC warning in target_alua_state_check · 1e3ab99d
      Paul Bolle authored
      Building target_core_alua.o triggers a GCC warning:
          drivers/target/target_core_alua.c: In function ‘target_alua_state_check’:
          drivers/target/target_core_alua.c:773:18: warning: ‘alua_ascq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             cmd->scsi_ascq = alua_ascq;
                            ^
      
      This is a false positive. A little trial and error shows it is
      apparently caused by core_alua_state_lba_dependent(). It must be hard
      for GCC to track the branches of a switch statement, inside a
      list_for_each_entry loop, inside a while loop.
      
      But if we add a small (inline) helper function we can reorganize the
      code a bit. That also allows to drop alua_ascq which, obviously, gets
      rid of this warning.
      Signed-off-by: 's avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      1e3ab99d
  13. 12 Feb, 2014 1 commit
    • Nicholas Bellinger's avatar
      target: Fix 32-bit + CONFIG_LBDAF=n link error w/ sector_div · cdf55949
      Nicholas Bellinger authored
      This patch changes core_alua_state_lba_dependent() to use do_div()
      instead sector_div() to avoid the following link error on 32-bit
      with CONFIG_LBDAF=n as reported by Jim:
      
      buildlog-1391099072.txt-drivers/built-in.o: In function `target_alua_state_check':
      buildlog-1391099072.txt-(.text+0x928d93): undefined reference to `__umoddi3'
      buildlog-1391099072.txt:make: *** [vmlinux] Error 1 --
      buildlog-1391101753.txt-  CC      init/version.o
      buildlog-1391101753.txt-  LD      init/built-in.o
      buildlog-1391101753.txt-drivers/built-in.o: In function `core_alua_state_lba_dependent':
      buildlog-1391101753.txt-/home/jim/linux/drivers/target/target_core_alua.c:503: undefined reference to `__umoddi3'
      buildlog-1391101753.txt:make: *** [vmlinux] Error 1
      Reported-by: 's avatarJim Davis <jim.epost@gmail.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      cdf55949
  14. 09 Jan, 2014 3 commits
  15. 17 Dec, 2013 4 commits
  16. 20 Nov, 2013 4 commits
  17. 10 Sep, 2013 3 commits
    • Nicholas Bellinger's avatar
      target: Update copyright ownership/year information to 2013 · 4c76251e
      Nicholas Bellinger authored
      Update copyright ownership/year information for target-core,
      loopback, iscsi-target, tcm_qla2xx, vhost and iser-target.
      Signed-off-by: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      4c76251e
    • Gera Kazakov's avatar
      target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out · f730f915
      Gera Kazakov authored
      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: 's avatarGera Kazakov <gkazakov@msn.com>
      Signed-off-by: 's avatarGera 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: 's avatarNicholas Bellinger <nab@linux-iscsi.org>
      f730f915
    • Nicholas Bellinger's avatar
      target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check · 89c12cc9
      Nicholas Bellinger authored
      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: 's avatarNicholas Bellinger <nab@daterainc.com>
      89c12cc9
  18. 12 Aug, 2013 1 commit
  19. 11 Apr, 2013 1 commit
  20. 26 Feb, 2013 1 commit
  21. 10 Jan, 2013 1 commit
  22. 27 Nov, 2012 1 commit
  23. 06 Nov, 2012 2 commits