1. 31 3月, 2016 1 次提交
  2. 28 2月, 2016 1 次提交
  3. 20 1月, 2016 2 次提交
    • N
      target: Obtain se_node_acl->acl_kref during get_initiator_node_acl · 21aaa23b
      Nicholas Bellinger 提交于
      This patch addresses a long standing race where obtaining
      se_node_acl->acl_kref in __transport_register_session()
      happens a bit too late, and leaves open the potential
      for core_tpg_del_initiator_node_acl() to hit a NULL
      pointer dereference.
      
      Instead, take ->acl_kref in core_tpg_get_initiator_node_acl()
      while se_portal_group->acl_node_mutex is held, and move the
      final target_put_nacl() from transport_deregister_session()
      into transport_free_session() so that fabric driver login
      failure handling using the modern method to still work
      as expected.
      
      Also, update core_tpg_get_initiator_node_acl() to take
      an extra reference for dynamically generated acls for
      demo-mode, before returning to fabric caller.  Also
      update iscsi-target sendtargets special case handling
      to use target_tpg_has_node_acl() when checking if
      demo_mode_discovery == true during discovery lookup.
      
      Note the existing wait_for_completion(&acl->acl_free_comp)
      in core_tpg_del_initiator_node_acl() does not change.
      
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      21aaa23b
    • N
      target: Convert ACL change queue_depth se_session reference usage · d36ad77f
      Nicholas Bellinger 提交于
      This patch converts core_tpg_set_initiator_node_queue_depth()
      to use struct se_node_acl->acl_sess_list when performing
      explicit se_tpg_tfo->shutdown_session() for active sessions,
      in order for new se_node_acl->queue_depth to take effect.
      
      This follows how core_tpg_del_initiator_node_acl() currently
      works when invoking se_tpg_tfo->shutdown-session(), and ahead
      of the next patch to take se_node_acl->acl_kref during lookup,
      the extra get_initiator_node_acl() can go away. In order to
      achieve this, go ahead and change target_get_session() to use
      kref_get_unless_zero() and propigate up the return value
      to know when a session is already being released.
      
      This is because se_node_acl->acl_group is already protecting
      se_node_acl->acl_group reference via configfs, and shutdown
      within core_tpg_del_initiator_node_acl() won't occur until
      sys_write() to core_tpg_set_initiator_node_queue_depth()
      attribute returns back to user-space.
      
      Also, drop the left-over iscsi-target hack, and obtain
      se_portal_group->session_lock in lio_tpg_shutdown_session()
      internally. Remove iscsi-target wrapper and unused se_tpg +
      force parameters and associated code.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d36ad77f
  4. 08 1月, 2016 1 次提交
  5. 11 9月, 2015 1 次提交
    • N
      target/qla2xxx: Honor max_data_sg_nents I/O transfer limit · 8f9b5654
      Nicholas Bellinger 提交于
      This patch adds an optional fabric driver provided SGL limit
      that target-core will honor as it's own internal I/O maximum
      transfer length limit, as exposed by EVPD=0xb0 block limits
      parameters.
      
      This is required for handling cases when host I/O transfer
      length exceeds the requested EVPD block limits maximum
      transfer length. The initial user of this logic is qla2xxx,
      so that we can avoid having to reject I/Os from some legacy
      FC hosts where EVPD=0xb0 parameters are not honored.
      
      When se_cmd payload length exceeds the provided limit in
      target_check_max_data_sg_nents() code, se_cmd->data_length +
      se_cmd->prot_length are reset with se_cmd->residual_count
      plus underflow bit for outgoing TFO response callbacks.
      It also checks for existing CDB level underflow + overflow
      and recalculates final residual_count as necessary.
      
      Note this patch currently assumes 1:1 mapping of PAGE_SIZE
      per struct scatterlist entry.
      Reported-by: NCraig Watson <craig.watson@vanguard-rugged.com>
      Cc: Craig Watson <craig.watson@vanguard-rugged.com>
      Tested-by: NHimanshu Madhani <himanshu.madhani@qlogic.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8f9b5654
  6. 24 7月, 2015 1 次提交
  7. 16 6月, 2015 2 次提交
  8. 01 6月, 2015 1 次提交
    • N
      target: Convert se_portal_group->tpg_lun_list[] to RCU hlist · 6bb82612
      Nicholas Bellinger 提交于
      This patch converts the fixed size se_portal_group->tpg_lun_list[]
      to use modern RCU with hlist_head in order to support an arbitary
      number of se_lun ports per target endpoint.
      
      It includes dropping core_tpg_alloc_lun() from core_dev_add_lun(),
      and calling it directly from target_fabric_make_lun() to allocate
      a new se_lun.  And add a new target_fabric_port_release() configfs
      item callback to invoke kfree_rcu() to release memory during
      se_lun->lun_group shutdown.
      
      Also now that se_node_acl->lun_entry_hlist is using RCU, convert
      existing tpg_lun_lock to struct mutex so core_tpg_add_node_to_devs()
      can perform RCU updater logic without releasing ->tpg_lun_mutex.
      
      Also, drop core_tpg_clear_object_luns() and it's single consumer
      in iscsi-target, which is duplicating TPG LUN shutdown logic and
      is current code results in a NOP.
      
      Finally, sbp-target and xen-scsiback fabric driver conversions are
      included, which are required due to the non-standard way they use
      ->tpg_lun_hlist.
      Reviewed-by: NHannes 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>
      Cc: Chris Boot <bootc@bootc.net>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6bb82612
  9. 31 5月, 2015 9 次提交
  10. 15 4月, 2015 1 次提交
    • 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
  11. 08 4月, 2015 1 次提交
    • 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
  12. 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
  13. 07 4月, 2014 2 次提交
    • 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
  14. 18 1月, 2014 1 次提交
    • N
      target: Add protection SGLs to target_submit_cmd_map_sgls · def2b339
      Nicholas Bellinger 提交于
      This patch adds support to target_submit_cmd_map_sgls() for
      accepting 'sgl_prot' + 'sgl_prot_count' parameters for
      DIF protection information.
      
      Note the passed parameters are stored at se_cmd->t_prot_sg
      and se_cmd->t_prot_nents respectively.
      
      Also, update tcm_loop and vhost-scsi fabrics usage of
      target_submit_cmd_map_sgls() to take into account the
      new parameters.
      
      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>
      def2b339
  15. 24 10月, 2013 1 次提交
  16. 11 9月, 2013 1 次提交
  17. 10 9月, 2013 2 次提交
  18. 08 7月, 2013 1 次提交
  19. 31 5月, 2013 1 次提交
  20. 21 5月, 2013 1 次提交
  21. 25 4月, 2013 1 次提交
  22. 14 12月, 2012 1 次提交
    • A
      target/iscsi_target: Add NodeACL tags for initiator group support · 79e62fc3
      Andy Grover 提交于
      Thanks for reviews, looking a lot better.
      
      ---- 8< ----
      
      Initiator access config could be easier. The way other storage vendors
      have addressed this is to support initiator groups: the admin adds
      initiator WWNs to the group, and then LUN permissions can be granted for
      the entire group at once.
      
      Instead of changing ktarget's configfs interface, this patch keeps
      the configfs interface per-initiator-wwn and just adds a 'tag' field
      for each. This should be enough for user tools like targetcli to group
      initiator ACLs and sync their configurations.
      
      acl_tag is not used internally, but needs to be kept in configfs so that
      all user tools can avoid dependencies on each other.
      
      Code tested to work, although userspace pieces still to be implemented.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      79e62fc3
  23. 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
  24. 03 10月, 2012 1 次提交
  25. 18 9月, 2012 2 次提交
  26. 18 7月, 2012 1 次提交
    • R
      target: Allow for target_submit_cmd() returning errors · d6dfc868
      Roland Dreier 提交于
      We want it to be possible for target_submit_cmd() to return errors up
      to its fabric module callers.  For now just update the prototype to
      return an int, and update all callers to handle non-zero return values
      as an error.
      
      This is immediately useful for tcm_qla2xxx to fix a long-standing active
      I/O session shutdown race, but tcm_fc, usb-gadget, and sbp-target the
      fabric maintainers need to check + ACK that handling a target_submit_cmd()
      failure due to session shutdown does not introduce regressions
      
      (nab: Respin against for-next after initial NACK + update docbook comment +
            fix double se_cmd init in exception path for usb-gadget)
      
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d6dfc868
  27. 17 7月, 2012 1 次提交
    • R
      target: Remove se_session.sess_wait_list · 1c7b13fe
      Roland Dreier 提交于
      Since we set se_session.sess_tearing_down and stop new commands from
      being added to se_session.sess_cmd_list before we wait for commands to
      finish when freeing a session, there's no need for a separate
      sess_wait_list -- if we let new commands be added to sess_cmd_list
      after setting sess_tearing_down, that would be a bug that breaks the
      logic of waiting in-flight commands.
      
      Also rename target_splice_sess_cmd_list() to
      target_sess_cmd_list_set_waiting(), since we are no longer splicing
      onto a separate list.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1c7b13fe