1. 01 Jun, 2015 3 commits
    • Nicholas Bellinger's avatar
      target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun · 79dc9c9e
      Nicholas Bellinger authored
      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: default avatarHannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      79dc9c9e
    • Nicholas Bellinger's avatar
      target/pr: Use atomic bitop for se_dev_entry->deve_flags reservation check · 80bfdfa9
      Nicholas Bellinger authored
      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: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      80bfdfa9
    • 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: default 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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      29a05dee
  2. 31 May, 2015 37 commits