1. 20 Jan, 2016 5 commits
    • Arnd Bergmann's avatar
      scsi: qla2xxxx: avoid type mismatch in comparison · fab683eb
      Arnd Bergmann authored
      A recent bug fix added code that does
      
              bool logged_out = (status & 0xFFFF);
              if (logged_out == CTIO_PORT_LOGGED_OUT)
      		...
      
      This looks wrong because we are comparing a boolean with an
      integer constant, ang gcc warns about it accordingly:
      
      drivers/scsi/qla2xxx/qla_target.c: In function 'qlt_do_ctio_completion':
      drivers/scsi/qla2xxx/qla_target.c:3587:20: warning: comparison of constant '41' with boolean expression is always false [-Wbool-compare]
              (logged_out == CTIO_PORT_LOGGED_OUT) ?
      
      The correct fix is presumably to make that variable an 'int'.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: 71cdc079 ("qla2xxx: Delete session if initiator is gone from FW")
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      fab683eb
    • Sheng Yang's avatar
      target/user: Make sure netlink would reach all network namespaces · 20c08b36
      Sheng Yang authored
      The current code only allow netlink to reach the initial network namespace,
      which caused trouble for any client running inside container.
      
      This patch would make sure TCMU netlink would work for all network
      namespaces.
      Signed-off-by: default avatarSheng Yang <sheng@yasker.org>
      Acked-by: default avatarAndy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      20c08b36
    • Nicholas Bellinger's avatar
      target: Obtain se_node_acl->acl_kref during get_initiator_node_acl · 21aaa23b
      Nicholas Bellinger authored
      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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      21aaa23b
    • Nicholas Bellinger's avatar
      target: Convert ACL change queue_depth se_session reference usage · d36ad77f
      Nicholas Bellinger authored
      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: default avatarChristoph 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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      d36ad77f
    • Nicholas Bellinger's avatar
      iscsi-target: Fix potential dead-lock during node acl delete · 26a99c19
      Nicholas Bellinger authored
      This patch is a iscsi-target specific bug-fix for a dead-lock
      that can occur during explicit struct se_node_acl->acl_group
      se_session deletion via configfs rmdir(2), when iscsi-target
      time2retain timer is still active.
      
      It changes iscsi-target to obtain se_portal_group->session_lock
      internally using spin_in_locked() to check for the specific
      se_node_acl configfs shutdown rmdir(2) case.
      
      Note this patch is intended for stable, and the subsequent
      v4.5-rc patch converts target_core_tpg.c to use proper
      se_sess->sess_kref reference counting for both se_node_acl
      deletion + se_node_acl->queue_depth se_session restart.
      Reported-by: default avatar: 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>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      26a99c19
  2. 13 Jan, 2016 2 commits
    • Nicholas Bellinger's avatar
      ib_srpt: Convert acl lookup to modern get_initiator_node_acl usage · f246c941
      Nicholas Bellinger authored
      This patch does a simple conversion of ib_srpt code to use
      proper modern core_tpg_get_initiator_node_acl() lookup using
      se_node_acl->acl_kref, and drops the legacy internal list
      usage from srpt_lookup_acl().
      
      This involves doing transport_init_session() earlier, and
      making sure transport_free_session() is called during
      a se_node_acl lookup failure to drop the last ->acl_kref.
      
      Also, it adds a minor backwards-compat hack to avoid the
      potential for user-space wrt node-acl WWPN formatting by
      simply stripping off '0x' prefix from ch->sess_name, and
      retrying once if core_tpg_get_initiator_node_acl() fails.
      
      Finally, go ahead and drop port_acl_list port_acl_lock
      since they are no longer used.
      
      Cc: Vu Pham <vu@mellanox.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      f246c941
    • Nicholas Bellinger's avatar
      tcm_fc: Convert acl lookup to modern get_initiator_node_acl usage · 7fbef3d0
      Nicholas Bellinger authored
      This patch does a simple conversion of tcm_fc code to use
      proper modern core_tpg_get_initiator_node_acl() lookup using
      se_node_acl->acl_kref, and drops the legacy list walk from
      ft_acl_get().
      
      Note the original lookup also took node_name into account,
      but since ft_init_nodeacl() only ever sets port_name for
      se_node_acl->acl_group within configfs, this is purely
      a mechanical change.
      
      As per HCH, go ahead and fold ft_acl_get() into original
      caller.
      
      Cc: Vasu Dev <vasu.dev@linux.intel.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      7fbef3d0
  3. 07 Jan, 2016 24 commits
  4. 06 Jan, 2016 6 commits
  5. 21 Dec, 2015 3 commits