1. 20 11月, 2013 2 次提交
  2. 14 11月, 2013 1 次提交
  3. 13 11月, 2013 1 次提交
    • N
      iscsi-target: Fix mutex_trylock usage in iscsit_increment_maxcmdsn · 5e8e6b4b
      Nicholas Bellinger 提交于
      This patch fixes a >= v3.10 regression bug with mutex_trylock() usage
      within iscsit_increment_maxcmdsn(), that was originally added to allow
      for a special case where ->cmdsn_mutex was already held from the
      iscsit_execute_cmd() exception path for ib_isert.
      
      When !mutex_trylock() was occuring under contention during normal RX/TX
      process context codepaths, the bug was manifesting itself as the following
      protocol error:
      
        Received CmdSN: 0x000fcbb7 is greater than MaxCmdSN: 0x000fcbb6, protocol error.
        Received CmdSN: 0x000fcbb8 is greater than MaxCmdSN: 0x000fcbb6, protocol error.
      
      This patch simply avoids the direct ib_isert callback in lio_queue_status()
      for the special iscsi_execute_cmd() exception cases, that allows the problematic
      mutex_trylock() usage in iscsit_increment_maxcmdsn() to go away.
      Reported-by: NMoussa Ba <moussaba@micron.com>
      Tested-by: NMoussa Ba <moussaba@micron.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5e8e6b4b
  4. 08 11月, 2013 1 次提交
  5. 24 10月, 2013 2 次提交
  6. 17 10月, 2013 3 次提交
  7. 11 9月, 2013 7 次提交
  8. 10 9月, 2013 6 次提交
    • N
      iscsi-target: Convert to per-cpu ida_alloc + ida_free command map · 988e3a85
      Nicholas Bellinger 提交于
      This patch changes iscsi-target to use transport_alloc_session_tags()
      pre-allocation logic for per-cpu session tag pooling with internal
      ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id.
      
      This includes tag pool setup based upon per NodeACL queue_depth after
      locating se_node_acl in iscsi_target_locate_portal().
      
      Also update iscsit_allocate_cmd() and iscsit_release_cmd() to use
      percpu_ida_alloc() and percpu_ida_free() respectively.
      
      v5 changes;
        - Convert to percpu_ida.h include
      
      v2 changes:
        - Fix bug with SessionType=Discovery in iscsi_target_locate_portal()
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      988e3a85
    • N
      iscsi/iser-target: Convert to command priv_size usage · d703ce2f
      Nicholas Bellinger 提交于
      This command converts iscsi/isert-target to use allocations based on
      iscsit_transport->priv_size within iscsit_allocate_cmd(), instead of
      using an embedded isert_cmd->iscsi_cmd.
      
      This includes removing iscsit_transport->alloc_cmd() usage, along
      with updating isert-target code to use iscsit_priv_cmd().
      
      Also, remove left-over iscsit_transport->release_cmd() usage for
      direct calls to iscsit_release_cmd(), and drop the now unused
      lio_cmd_cache and isert_cmd_cache.
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d703ce2f
    • N
      iscsi-target: Remove left-over iscsi_target_do_login_io · ea3a179a
      Nicholas Bellinger 提交于
      There is no need for iscsi_target_do_login_io() anymore in modern code,
      so go ahead and call iscsi_target_do_tx_login_io() directly within
      iscsi_target_do_login().
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ea3a179a
    • N
      iscsi-target: Add sk->sk_state_change to cleanup after TCP failure · bb048357
      Nicholas Bellinger 提交于
      This patch adds a sock->sk_state_change() -> iscsi_target_sk_state_change()
      callback in order to handle transient TCP failures during the login process,
      where sock->sk_data_ready() -> iscsi_target_sk_data_ready() may not be
      called to release connection resources, and relinquish tpg->np_login_lock
      via iscsit_deaccess_np()
      
      It performs the sk->sk_state check using iscsi_target_sk_state_check() to
      look for TCP_CLOSE_WAIT + TCP_CLOSE, and invokes schedule_delayed_work() ->
      iscsi_target_do_cleanup() to perform the remaining cleanup from process
      context.
      
      It adds an explicit sk_state_check to iscsi_target_do_login() in order
      to determine a state failure when iscsi_target_sk_state_change() may
      not be able to proceed before LOGIN_FLAGS_READY=1 is set.
      
      Also use sk->sk_sndtimeo -> sk->sk_rcvtimeo settings during login to
      iscsi_target_set_sock_callbacks(), and revert back post login to use
      MAX_SCHEDULE_TIMEOUT in iscsi_target_restore_sock_callbacks().
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bb048357
    • N
      iscsi-target: Add login negotiation multi-plexing support · d381a801
      Nicholas Bellinger 提交于
      This patch adds support for login negotiation multi-plexing in
      iscsi-target code.
      
      This involves handling the first login request PDU + payload and
      login response PDU + payload within __iscsi_target_login_thread()
      process context, and then changing struct sock->sk_data_ready()
      so that all subsequent exchanges are handled by workqueue process
      context, to allow other incoming login requests to be received
      in parallel by __iscsi_target_login_thread().
      
      Upon login negotiation completion (or failure), ->sk_data_ready()
      is replaced with the original kernel sockets handler saved in
      iscsi_conn->orig_data_ready.
      
      v3 changes:
        - Convert iscsi_target_sk_data_ready() lock access to
          write[lock,unlock]_bh()
        - Only clear LOGIN_FLAGS_READ_ACTIVE when iscsi_target_do_login()
          returns zero
        - Add LOGIN_FLAGS_READY + LOGIN_FLAGS_CLOSED bit checks to
          iscsi_target_sk_data_ready()
        - Make INIT_DELAYED_WORK() + iscsi_target_set_sock_callbacks() setup
          happen earlier by moving from iscsi_target_start_negotiation() into
          iscsi_target_locate_portal()
        - Set LOGIN_FLAGS_READY bit in iscsi_target_start_negotiation()
          after iscsi_target_do_login() returns zero.
      
      v2 changes:
        - Add login_timer in iscsi_target_do_login_rx() to avoid
          possible endless sleep with MSG_WAITALL for traditional
          iscsi-target in certain network configurations.
        - Convert lprintk() -> pr_debug()
        - Remove forward declarations of iscsi_target_set_sock_callbacks(),
          iscsi_target_restore_sock_callbacks() and iscsi_target_sk_data_ready()
        - Make iscsi_target_set_sock_callbacks + iscsi_target_restore_sock_callbacks()
          static (Fengguang)
        - Make iscsi_target_do_login_rx() safe for iser-target w/o conn->sock
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d381a801
    • N
      iscsi-target: Prepare login code for multi-plexing support · a91eb7d9
      Nicholas Bellinger 提交于
      This patch prepares the iscsi-target login code for multi-plexing
      support.  This includes:
      
       - Adding iscsi_tpg_np->tpg_np_kref + iscsit_login_kref_put() for
         handling callback of iscsi_tpg_np->tpg_np_comp
       - Adding kref_put() in iscsit_deaccess_np()
       - Adding kref_put() and wait_for_completion() in
         iscsit_reset_np_thread()
       - Refactor login failure path release logic into
         iscsi_target_login_sess_out()
       - Update __iscsi_target_login_thread() to handle
         iscsi_post_login_handler() asynchronous completion
       - Add shutdown parameter for iscsit_clear_tpg_np_login_thread*()
      
      v3 changes:
       - Convert iscsi_portal_group->np_login_lock to ->np_login_sem
       - Add LOGIN_FLAGS definitions
      
      v2 changes:
       - Remove duplicate call to iscsi_post_login_handler() in
         __iscsi_target_login_thread()
       - Drop unused iscsi_np->np_login_tpg
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a91eb7d9
  9. 24 8月, 2013 2 次提交
    • N
      iscsi-target: Fix potential NULL pointer in solicited NOPOUT reject · 28aaa950
      Nicholas Bellinger 提交于
      This patch addresses a potential NULL pointer dereference regression in
      iscsit_setup_nop_out() code, specifically for two cases when a solicited
      NOPOUT triggers a ISCSI_REASON_PROTOCOL_ERROR reject to be generated.
      
      This is because iscsi_cmd is expected to be NULL for solicited NOPOUT
      case before iscsit_process_nop_out() locates the descriptor via TTT
      using iscsit_find_cmd_from_ttt().
      
      This regression was originally introduced in:
      
      commit ba159914
      Author: Nicholas Bellinger <nab@linux-iscsi.org>
      Date:   Wed Jul 3 03:48:24 2013 -0700
      
          iscsi-target: Fix iscsit_add_reject* usage for iser
      
      Cc: stable@vger.kernel.org  # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      28aaa950
    • N
      iscsi-target: Fix iscsit_transport reference leak during NP thread reset · c9a03c12
      Nicholas Bellinger 提交于
      This patch fixes a bug in __iscsi_target_login_thread() where an explicit
      network portal thread reset ends up leaking the iscsit_transport module
      reference, along with the associated iscsi_conn allocation.
      
      This manifests itself with iser-target where a NP reset causes the extra
      iscsit_transport reference to be taken in iscsit_conn_set_transport()
      during the reset, which prevents the ib_isert module from being unloaded
      after the NP thread shutdown has finished.
      
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c9a03c12
  10. 22 8月, 2013 1 次提交
    • N
      iscsi-target: Fix ImmediateData=Yes failure regression in >= v3.10 · 9d86a2be
      Nicholas Bellinger 提交于
      This patch addresses a regression bug within ImmediateData=Yes failure
      handling that ends up triggering an OOPs within >= v3.10 iscsi-target
      code.
      
      The problem occurs when iscsit_process_scsi_cmd() does the call to
      target_put_sess_cmd(), and once again in iscsit_get_immediate_data()
      that is triggered during two different cases:
      
       - When iscsit_sequence_cmd() returns CMDSN_LOWER_THAN_EXP, for which
         the descriptor state will already have been set to ISTATE_REMOVE
         by iscsit_sequence_cmd(), and
       - When iscsi_cmd->sense_reason is set, for which iscsit_execute_cmd()
         will have already called transport_send_check_condition_and_sense()
         to queue the exception response.
      
      It changes iscsit_process_scsi_cmd() to drop the early call, and makes
      iscsit_get_immediate_data() call target_put_sess_cmd() from a single
      location after dumping the immediate data for the failed command.
      
      The regression was initially introduced in commit:
      
      commit 561bf158
      Author: Nicholas Bellinger <nab@linux-iscsi.org>
      Date:   Wed Jul 3 03:58:58 2013 -0700
      
          iscsi-target: Fix iscsit_sequence_cmd reject handling for iser
      
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9d86a2be
  11. 13 8月, 2013 2 次提交
    • C
      iscsi-target: ST response on IN6ADDR_ANY socket · dfecf611
      Chris Leech 提交于
      Odd little issue, found that if you create an IPv6 portal bound to the
      IN6ADDR_ANY wildcard address it will accept IPv4 connections (as long as
      bindv6only isn't set globally) but respond to SendTargets requests with
      an IPv4-mapped IPv6 address.
      
      Example over loopback:
      
       In targetcli create a wildcard IPv6 portal
         /iscsi/iqn.../portals/> create ::
       Which should create a portal [::]:3260
      
       Initiate SendTargets discovery to the portal using an IPv4 address
         # iscsiadm -m discovery -t st -p 127.0.0.1
       The response formats TargetAddress as [::ffff:127.0.0.1]:3260,1
      
      This still works and uses v4 on the network between two v6 sockets, but
      only if the initiator supports IPv6 with v4-mapped addresses.
      
      This change detects v4-mapped address on v6 sockets for the wildcard
      case, and instead formats the TargetAddress response as an IPv4 address.
      
      In order to not further complicate iscsit_build_sendtargets_response,
      I've actually simplified it by moving the bracket wrapping of IPv6
      address into iscsit_accept_np where local_ip and login_ip strings are
      set.  That also simplifies iscsi_stat_tgt_attr_show_attr_fail_intr_addr.
      
      Side effect of the string format change is that
      lio_target_nacl_show_info will now print login_ip bracket wrapped for
      IPv6 connections, as will a few debug prints.
      Signed-off-by: NChris Leech <cleech@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      dfecf611
    • J
      target: replace strict_strto*() with kstrto*() · 57103d7f
      Jingoo Han 提交于
      The usage of strict_strtoul() and strict_strtoull() is not preferred,
      because strict_strtoul() and strict_strtoull() are obsolete. Thus,
      kstrtoul() and kstrtoull() should be used.
      
      v2: Fix incorrect return in ft_add_tpg (Fengguang)
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      57103d7f
  12. 08 7月, 2013 6 次提交
  13. 07 7月, 2013 3 次提交
    • N
      iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser · 186a9647
      Nicholas Bellinger 提交于
      This patch adds target_get_sess_cmd reference counting for
      iscsit_handle_task_mgt_cmd(), and adds a target_put_sess_cmd()
      for the failure case.
      
      It also fixes a bug where ISCSI_OP_SCSI_TMFUNC type commands
      where leaking iscsi_cmd->i_conn_node and eventually triggering
      an OOPs during struct isert_conn shutdown.
      
      Cc: stable@vger.kernel.org  # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      186a9647
    • N
      iscsi-target: Fix iscsit_sequence_cmd reject handling for iser · 561bf158
      Nicholas Bellinger 提交于
      This patch moves ISCSI_OP_REJECT failures into iscsit_sequence_cmd()
      in order to avoid external iscsit_reject_cmd() reject usage for all
      PDU types.
      
      It also updates PDU specific handlers for traditional iscsi-target
      code to not reset the session after posting a ISCSI_OP_REJECT during
      setup.
      
      (v2: Fix CMDSN_LOWER_THAN_EXP for ISCSI_OP_SCSI to call
           target_put_sess_cmd() after iscsit_sequence_cmd() failure)
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: stable@vger.kernel.org  # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      561bf158
    • N
      iscsi-target: Fix iscsit_add_reject* usage for iser · ba159914
      Nicholas Bellinger 提交于
      This patch changes iscsit_add_reject() + iscsit_add_reject_from_cmd()
      usage to not sleep on iscsi_cmd->reject_comp to address a free-after-use
      usage bug in v3.10 with iser-target code.
      
      It saves ->reject_reason for use within iscsit_build_reject() so the
      correct value for both transport cases.  It also drops the legacy
      fail_conn parameter usage throughput iscsi-target code and adds
      two iscsit_add_reject_cmd() and iscsit_reject_cmd helper functions,
      along with various small cleanups.
      
      (v2: Re-enable target_put_sess_cmd() to be called from
           iscsit_add_reject_from_cmd() for rejects invoked after
           target_get_sess_cmd() has been called)
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: stable@vger.kernel.org  # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ba159914
  14. 04 7月, 2013 3 次提交