1. 13 12月, 2014 12 次提交
    • S
      iser-target: Unite error completion handler for RX and TX · df43debd
      Sagi Grimberg 提交于
      As a pre-step to a single CQ, we unite the error completion
      handlers to a single handler.
      
      This patch does not change any functionality.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      df43debd
    • S
      iser-target: Remove interrupt coalescing · 68a86dee
      Sagi Grimberg 提交于
      It is disabled at the moment, we will get that back
      in once the target is more stable.
      
      This reverts commit 95b60f07
      "Add support for completion interrupt coalescing"
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      68a86dee
    • S
      iser-target: Work-around live target stack shutdown resource cleanup · 268e6811
      Sagi Grimberg 提交于
      Currently we have no way to tell that the target stack is in shutdown
      sequence. In case we have open connections, the initiator immediately
      attempts to reconnect in a DDOS attack style, so we may end up
      terminating the iser enabled network portal while it's np_accept_list
      still have pending connections.
      
      The workaround is simply release all the connections in the list.
      A proper fix will be to start shutdown sequence by shutting the
      network portal to avoid initiator immediate reconnect attempts.
      
      But the temporary work around seems to work at this point, so I think
      we can do this for now...
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      268e6811
    • S
      iscsi,iser-target: Expose supported protection ops according to t10_pi · 23a548ee
      Sagi Grimberg 提交于
      iSER will report supported protection operations based on
      the tpg attribute t10_pi settings and HCA PI offload capabilities.
      If the HCA does not support PI offload or tpg attribute t10_pi is
      not set, we fall to SW PI mode.
      
      In order to do that, we move iscsit_get_sup_prot_ops after connection
      tpg assignment.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      23a548ee
    • S
      iser-target: Fix NULL dereference in SW mode DIF · 302cc7c3
      Sagi Grimberg 提交于
      Fallback to software mode DIF if HCA does not support
      PI (without crashing obviously). It is still possible to
      run with backend protection and an unprotected frontend,
      so looking at the command prot_op is not enough. Check
      device PI capability on a per-IO basis (isert_prot_cmd
      inline static) to determine if we need to handle protection
      information.
      
      Trace:
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
      IP: [<ffffffffa037f8b1>] isert_reg_sig_mr+0x351/0x3b0 [ib_isert]
      Call Trace:
       [<ffffffff812b003a>] ? swiotlb_map_sg_attrs+0x7a/0x130
       [<ffffffffa038184d>] isert_reg_rdma+0x2fd/0x370 [ib_isert]
       [<ffffffff8108f2ec>] ? idle_balance+0x6c/0x2c0
       [<ffffffffa0382b68>] isert_put_datain+0x68/0x210 [ib_isert]
       [<ffffffffa02acf5b>] lio_queue_data_in+0x2b/0x30 [iscsi_target_mod]
       [<ffffffffa02306eb>] target_complete_ok_work+0x21b/0x310 [target_core_mod]
       [<ffffffff8106ece2>] process_one_work+0x182/0x3b0
       [<ffffffff8106fda0>] worker_thread+0x120/0x3c0
       [<ffffffff8106fc80>] ? maybe_create_worker+0x190/0x190
       [<ffffffff8107594e>] kthread+0xce/0xf0
       [<ffffffff81075880>] ? kthread_freezable_should_stop+0x70/0x70
       [<ffffffff8159a22c>] ret_from_fork+0x7c/0xb0
       [<ffffffff81075880>] ? kthread_freezable_should_stop+0x70/0x70
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      302cc7c3
    • S
      iser-target: Allocate PI contexts dynamically · 570db170
      Sagi Grimberg 提交于
      This patch converts to allocate PI contexts dynamically in order
      avoid a potentially bogus np->tpg_np and associated NULL pointer
      dereference in isert_connect_request() during iser-target endpoint
      shutdown with multiple network portals.
      
      Also, there is really no need to allocate these at connection
      establishment since it is not guaranteed that all the IOs on
      that connection will be to a PI formatted device.
      
      We can do it in a lazy fashion so the initial burst will have a
      transient slow down, but very fast all IOs will allocate a PI
      context.
      
      Squashed:
      
      iser-target: Centralize PI context handling code
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      570db170
    • S
      iser-target: Fix implicit termination of connections · b02efbfc
      Sagi Grimberg 提交于
      In situations such as bond failover, The new session establishment
      implicitly invokes the termination of the old connection.
      
      So, we don't want to wait for the old connection wait_conn to completely
      terminate before we accept the new connection and post a login response.
      
      The solution is to deffer the comp_wait completion and the conn_put to
      a work so wait_conn will effectively be non-blocking (flush errors are
      assumed to come very fast).
      
      We allocate isert_release_wq with WQ_UNBOUND and WQ_UNBOUND_MAX_ACTIVE
      to spread the concurrency of release works.
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b02efbfc
    • S
      iser-target: Handle ADDR_CHANGE event for listener cm_id · ca6c1d82
      Sagi Grimberg 提交于
      The np listener cm_id will also get ADDR_CHANGE event
      upcall (in case it is bound to a specific IP). Handle
      it correctly by creating a new cm_id and implicitly
      destroy the old one.
      
      Since this is the second event a listener np cm_id may
      encounter, we move the np cm_id event handling to a
      routine.
      
      Squashed:
      
      iser-target: Move cma_id setup to a function
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ca6c1d82
    • S
      iser-target: Fix connected_handler + teardown flow race · 19e2090f
      Sagi Grimberg 提交于
      Take isert_conn pointer from cm_id->qp->qp_context. This
      will allow us to know that the cm_id context is always
      the network portal. This will make the cm_id event check
      (connection or network portal) more reliable.
      
      In order to avoid a NULL dereference in cma_id->qp->qp_context
      we destroy the qp after we destroy the cm_id (and make the
      dereference safe). session stablishment/teardown sequences
      can happen in parallel, we should take into account that
      connected_handler might race with connection teardown flow.
      
      Also, protect isert_conn->conn_device->active_qps decrement
      within the error patch during QP creation failure and the
      normal teardown path in isert_connect_release().
      
      Squashed:
      
      iser-target: Decrement completion context active_qps in error flow
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      19e2090f
    • S
      iser-target: Parallelize CM connection establishment · 2371e5da
      Sagi Grimberg 提交于
      There is no point in accepting a new CM request only
      when we are completely done with the last iscsi login.
      Instead we accept immediately, this will also cause the
      CM connection to reach connected state and the initiator
      is allowed to send the first login. We mark that we got
      the initial login and let iscsi layer pick it up when it
      gets there.
      
      This reduces the parallel login sequence by a factor of
      more then 4 (and more for multi-login) and also prevents
      the initiator (who does all logins in parallel) from
      giving up on login timeout expiration.
      
      In order to support multiple login requests sequence (CHAP)
      we call isert_rx_login_req from isert_rx_completion insead
      of letting isert_get_login_rx call it.
      
      Squashed:
      
      iser-target: Use kref_get_unless_zero in connected_handler
      iser-target: Acquire conn_mutex when changing connection state
      iser-target: Reject connect request in failure path
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2371e5da
    • S
      iser-target: Fix flush + disconnect completion handling · 128e9cc8
      Sagi Grimberg 提交于
      ISER_CONN_UP state is not sufficient to know if
      we should wait for completion of flush errors and
      disconnected_handler event.
      
      Instead, split it to 2 states:
      - ISER_CONN_UP: Got to CM connected phase, This state
      indicates that we need to wait for a CM disconnect
      event before going to teardown.
      
      - ISER_CONN_FULL_FEATURE: Got to full feature phase
      after we posted login response, This state indicates
      that we posted recv buffers and we need to wait for
      flush completions before going to teardown.
      
      Also avoid deffering disconnected handler to a work,
      and handle it within disconnected handler.
      More work here is needed to handle DEVICE_REMOVAL event
      correctly (cleanup all resources).
      
      Squashed:
      
      iser-target: Don't deffer disconnected handler to a work
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      128e9cc8
    • S
      iscsi,iser-target: Initiate termination only once · 954f2372
      Sagi Grimberg 提交于
      Since commit 0fc4ea70 ("Target/iser: Don't put isert_conn inside
      disconnected handler") we put the conn kref in isert_wait_conn, so we
      need .wait_conn to be invoked also in the error path.
      
      Introduce call to isert_conn_terminate (called under lock)
      which transitions the connection state to TERMINATING and calls
      rdma_disconnect. If the state is already teminating, just bail
      out back (temination started).
      
      Also, make sure to destroy the connection when getting a connect
      error event if didn't get to connected (state UP). Same for the
      handling of REJECTED and UNREACHABLE cma events.
      
      Squashed:
      
      iscsi-target: Add call to wait_conn in establishment error flow
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      954f2372
  2. 20 11月, 2014 1 次提交
  3. 03 11月, 2014 2 次提交
  4. 09 10月, 2014 2 次提交
  5. 05 10月, 2014 1 次提交
  6. 04 10月, 2014 1 次提交
  7. 16 9月, 2014 4 次提交
  8. 12 6月, 2014 2 次提交
  9. 04 6月, 2014 1 次提交
    • N
      iser-target: Add missing target_put_sess_cmd for ImmedateData failure · 6cc44a6f
      Nicholas Bellinger 提交于
      This patch addresses a bug where an early exception for SCSI WRITE
      with ImmediateData=Yes was missing the target_put_sess_cmd() call
      to drop the extra se_cmd->cmd_kref reference obtained during the
      normal iscsit_setup_scsi_cmd() codepath execution.
      
      This bug was manifesting itself during session shutdown within
      isert_cq_rx_comp_err() where target_wait_for_sess_cmds() would
      end up waiting indefinately for the last se_cmd->cmd_kref put to
      occur for the failed SCSI WRITE + ImmediateData descriptors.
      
      This fix follows what traditional iscsi-target code already does
      for the same failure case within iscsit_get_immediate_data().
      Reported-by: NSagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6cc44a6f
  10. 21 5月, 2014 3 次提交
  11. 20 5月, 2014 2 次提交
    • S
      Target/iser: Fix hangs in connection teardown · 9d49f5e2
      Sagi Grimberg 提交于
      In ungraceful teardowns isert close flows seem racy such that
      isert_wait_conn hangs as RDMA_CM_EVENT_DISCONNECTED never
      gets invoked (no one called rdma_disconnect).
      
      Both graceful and ungraceful teardowns will have rx flush errors
      (isert posts a batch once connection is established). Once all
      flush errors are consumed we invoke isert_wait_conn and it will
      be responsible for calling rdma_disconnect. This way it can be
      sure that rdma_disconnect was called and it won't wait forever.
      
      This patch also removes the logout_posted indicator. either the
      logout completion was consumed and no problem decrementing the
      post_send_buf_count, or it was consumed as a flush error. no point
      of keeping it for isert_wait_conn as there is no danger that
      isert_conn will be accidentally removed while it is running.
      
      (Drop unnecessary sleep_on_conn_wait_comp check in
       isert_cq_rx_comp_err - nab)
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9d49f5e2
    • S
      Target/iser: Bail from accept_np if np_thread is trying to close · e346ab34
      Sagi Grimberg 提交于
      In case np_thread state is in RESET/SHUTDOWN/EXIT states,
      no point for isert to stall there as we may get a hang in
      case no one will wake it up later.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e346ab34
  12. 16 5月, 2014 3 次提交
  13. 07 4月, 2014 6 次提交
    • 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
    • S
      Target/iser: Use Fastreg only if device supports signature · f2252258
      Sagi Grimberg 提交于
      Fastreg is mandatory for signature, so if the
      device doesn't support it we don't need to use it.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f2252258
    • N
      iser-target: Add missing se_cmd put for WRITE_PENDING in tx_comp_err · 03e7848a
      Nicholas Bellinger 提交于
      This patch fixes a bug where outstanding RDMA_READs with WRITE_PENDING
      status require an extra target_put_sess_cmd() in isert_put_cmd() code
      when called from isert_cq_tx_comp_err() + isert_cq_drain_comp_llist()
      context during session shutdown.
      
      The extra kref PUT is required so that transport_generic_free_cmd()
      invokes the last target_put_sess_cmd() -> target_release_cmd_kref(),
      which will complete(&se_cmd->cmd_wait_comp) the outstanding se_cmd
      descriptor with WRITE_PENDING status, and awake the completion in
      target_wait_for_sess_cmds() to invoke TFO->release_cmd().
      
      The bug was manifesting itself in target_wait_for_sess_cmds() where
      a se_cmd descriptor with WRITE_PENDING status would end up sleeping
      indefinately.
      Acked-by: NSagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: <stable@vger.kernel.org> #3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      03e7848a
    • 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
    • N
      iser-target: Match FRMR descriptors to available session tags · f46d6a8a
      Nicholas Bellinger 提交于
      This patch changes isert_conn_create_fastreg_pool() to follow
      logic in iscsi_target_locate_portal() for determining how many
      FRMR descriptors to allocate based upon the number of possible
      per-session command slots that are available.
      
      This addresses an OOPs in isert_reg_rdma() where due to the
      use of ISCSI_DEF_XMIT_CMDS_MAX could end up returning a bogus
      fast_reg_descriptor when the number of active tags exceeded
      the original hardcoded max.
      
      Note this also includes moving isert_conn_create_fastreg_pool()
      from isert_connect_request() to isert_put_login_tx() before
      posting the final Login Response PDU in order to determine the
      se_nacl->queue_depth (eg: number of tags) per session the target
      will be enforcing.
      
      v2 changes:
        - Move isert_conn->conn_fr_pool list_head init into
          isert_conn_request()
      v3 changes:
        - Drop unnecessary list_empty() check in isert_reg_rdma()
          (Sagi)
      
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: <stable@vger.kernel.org> #3.12+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f46d6a8a
    • S
      Target/iser: Fail SCSI WRITE command if device detected integrity error · 5bac4b1a
      Sagi Grimberg 提交于
      If during data-transfer a data-integrity error was detected we
      must fail the command with CHECK_CONDITION and not execute
      the command.
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Reported-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5bac4b1a