1. 01 6月, 2015 11 次提交
    • C
      target: simplify backend driver registration · 0a06d430
      Christoph Hellwig 提交于
      Rewrite the backend driver registration based on what we did to the fabric
      drivers:  introduce a read-only struct target_bakckend_ops that the driver
      registers, which is then instanciate as a struct target_backend by the
      core.  This allows the ops vector to be smaller and allows us to mark it
      const.  At the same time the registration function can set up the
      configfs attributes, avoiding the need to add additional boilerplate code
      for that to the drivers.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0a06d430
    • N
      target: Drop left-over se_lun->lun_status · 46247737
      Nicholas Bellinger 提交于
      Now that se_portal_group->tpg_lun_hlist is a RCU protected hlist,
      go ahead and drop the left-over lun->lun_status usage.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      46247737
    • N
      target: Only reset specific dynamic entries during lun_group creation · df9766ca
      Nicholas Bellinger 提交于
      This patch changes core_tpg_add_node_to_devs() to avoid unnecessarly
      resetting every se_dev_entry in se_node_acl->tpg_lun_hlist when the
      operation is driven by an explicit configfs se_lun->lun_group creation
      via core_dev_add_lun() to only update a single se_lun.
      
      Otherwise for the second core_tpg_check_initiator_node_acl() case, go
      ahead and continue to scan the full set of currently active se_lun in
      se_portal_group->tpg_lun_hlist.
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      df9766ca
    • N
      target: Drop unused se_lun->lun_acl_list · 84786546
      Nicholas Bellinger 提交于
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      84786546
    • N
      target: Convert core_tpg_deregister to use list splice · 22793de5
      Nicholas Bellinger 提交于
      This patch converts core_tpg_deregister() to perform a list splice
      for any remaining dynamically generated se_node_acls attached to
      se_tpg, before calling kfree(nacl) to free memory.
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      22793de5
    • N
      target: Convert se_tpg->acl_node_lock to ->acl_node_mutex · 403edd78
      Nicholas Bellinger 提交于
      This patch converts se_tpg->acl_node_lock to struct mutex, so that
      ->acl_node_acl walkers in core_clear_lun_from_tpg() can block when
      calling core_disable_device_list_for_node().
      
      It also updates core_dev_add_lun() to hold ->acl_node_mutex when
      calling core_tpg_add_node_to_devs() to build ->lun_entry_hlist
      for dynamically generated se_node_acl.
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      403edd78
    • 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
    • C
      target/pr: cleanup core_scsi3_pr_seq_non_holder · 9fcb57f3
      Christoph Hellwig 提交于
      Clean up the mess of registered variables, and pass the isid mismatch
      flag explicitly instead of overloading the registration type.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9fcb57f3
    • N
      target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun · 79dc9c9e
      Nicholas Bellinger 提交于
      This patch changes __core_scsi3_do_alloc_registration() code to
      drop pr_reg->pr_reg_tg_pt_lun pointer usage in favor of a new
      pr_reg RPTI + existing pr_reg->pr_aptpl_target_lun used by
      APTPL metadata logic.
      
      It also includes changes to REGISTER, REGISTER_AND_MOVE and APTPL
      feature bit codepaths to use rcu_dereference_check() with the
      expected non-zero se_dev_entry->pr_kref reference held.
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      79dc9c9e
    • N
      target/pr: Use atomic bitop for se_dev_entry->deve_flags reservation check · 80bfdfa9
      Nicholas Bellinger 提交于
      This patch converts the core_scsi3_pr_seq_non_holder() check for non
      reservation holding registrations to use an atomic bitop in ->deve_flags
      to determine if a registration is currently active.
      
      It also includes associated a set_bit() in __core_scsi3_add_registration()
      and clear_bit() in __core_scsi3_free_registration(), if se_dev_entry still
      exists, and has not already been released via se_dev_entry shutdown path
      in core_disable_device_list_for_node().
      
      Also, clear_bit in core_disable_device_list_for_node as well to ensure
      the read-critical path in core_scsi3_pr_seq_non_holder() picks up the
      new state, preceeding the final kfree_rcu() call.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      80bfdfa9
    • N
      target: Convert se_node_acl->device_list[] to RCU hlist · 29a05dee
      Nicholas Bellinger 提交于
      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: 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>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      29a05dee
  2. 31 5月, 2015 29 次提交