1. 04 7月, 2013 2 次提交
  2. 26 6月, 2013 1 次提交
    • N
      iscsi-target: Refactor ISCSI_OP_TEXT_RSP TX handling · 889c8a68
      Nicholas Bellinger 提交于
      This patch refactoring existing iscsit_send_text_rsp() in order
      to handle iscsi_text_rsp payloads in a transport specific manner.
      
      This includes the addition of iscsit_build_text_rsp() to build
      the response payload and initialize ISCSI_OP_TEXT_RSP.
      
      v2: Make iscsit_build_text_rsp() determine extra padding bytes, and
          drop legacy padding calculation for traditional iSCSI text
          responses within iscsit_send_text_rsp()
      Reported-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      889c8a68
  3. 25 6月, 2013 2 次提交
    • N
      iscsi-target: Refactor ISCSI_OP_TEXT RX handling · 64534aa7
      Nicholas Bellinger 提交于
      This patch refactors ISCSI_OP_TEXT handling within iscsi-target in
      order to handle iscsi_text payloads in a transport specific manner.
      
      This includes splitting current iscsit_handle_text_cmd() into
      iscsit_setup_text_cmd() and iscsit_process_text_cmd() calls, and
      makes iscsit_handle_text_cmd be only used internally by traditional
      iscsi socket calls.
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      64534aa7
    • N
      iscsi/isert-target: Refactor ISCSI_OP_NOOP RX handling · 778de368
      Nicholas Bellinger 提交于
      This patch refactors ISCSI_OP_NOOP handling within iscsi-target in
      order to handle iscsi_nopout payloads in a transport specific manner.
      
      This includes splitting existing iscsit_handle_nop_out() into
      iscsit_setup_nop_out() and iscsit_process_nop_out() calls, and
      makes iscsit_handle_nop_out() be only used internally by traditional
      iscsi socket calls.
      
      Next update iser-target code to use new callers and add FIXME for
      the handling iscsi_nopout payloads.  Also fix reject response handling
      in iscsit_setup_nop_out() to use proper iscsit_add_reject_from_cmd().
      
      v2: Fix uninitialized iscsit_handle_nop_out() payload_length usage (Fengguang)
      v3: Remove left-over dead code in iscsit_setup_nop_out() (DanC)
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      778de368
  4. 21 6月, 2013 1 次提交
  5. 31 5月, 2013 1 次提交
    • N
      iscsi-target: Fix iscsit_free_cmd() se_cmd->cmd_kref shutdown handling · aafc9d15
      Nicholas Bellinger 提交于
      With the introduction of target_get_sess_cmd() referencing counting for
      ISCSI_OP_SCSI_CMD processing with iser-target, iscsit_free_cmd() usage
      in traditional iscsi-target driver code now needs to be aware of the
      active I/O shutdown case when a remaining se_cmd->cmd_kref reference may
      exist after transport_generic_free_cmd() completes, requiring a final
      target_put_sess_cmd() to release iscsi_cmd descriptor memory.
      
      This patch changes iscsit_free_cmd() to invoke __iscsit_free_cmd() before
      transport_generic_free_cmd() -> target_put_sess_cmd(), and also avoids
      aquiring the per-connection queue locks for typical fast-path calls
      during normal ISTATE_REMOVE operation.
      
      Also update iscsit_free_cmd() usage throughout iscsi-target to
      use the new 'bool shutdown' parameter.
      
      This patch fixes a regression bug introduced during v3.10-rc1 in
      commit 3e1c81a9, that was causing the following WARNING to appear:
      
      [  257.235153] ------------[ cut here]------------
      [  257.240314] WARNING: at kernel/softirq.c:160 local_bh_enable_ip+0x3c/0x86()
      [  257.248089] Modules linked in: vhost_scsi ib_srpt ib_cm ib_sa ib_mad ib_core tcm_qla2xxx tcm_loop
      	tcm_fc libfc iscsi_target_mod target_core_pscsi target_core_file
      	target_core_iblock target_core_mod configfs ipv6 iscsi_tcp libiscsi_tcp
      	libiscsi scsi_transport_iscsi loop acpi_cpufreq freq_table mperf
      	kvm_intel kvm crc32c_intel button ehci_pci pcspkr joydev i2c_i801
      	microcode ext3 jbd raid10 raid456 async_pq async_xor xor async_memcpy
      	async_raid6_recov raid6_pq async_tx raid1 raid0 linear igb hwmon
      	i2c_algo_bit i2c_core ptp ata_piix libata qla2xxx uhci_hcd ehci_hcd
      	mlx4_core scsi_transport_fc scsi_tgt pps_core
      [  257.308748] CPU: 1 PID: 3295 Comm: iscsi_ttx Not tainted 3.10.0-rc2+ #103
      [  257.316329] Hardware name: Intel Corporation S5520HC/S5520HC, BIOS S5500.86B.01.00.0057.031020111721 03/10/2011
      [  257.327597]  ffffffff814c24b7 ffff880458331b58 ffffffff8138eef2 ffff880458331b98
      [  257.335892]  ffffffff8102c052 ffff880400000008 0000000000000000 ffff88085bdf0000
      [  257.344191]  ffff88085bdf00d8 ffff88085bdf00e0 ffff88085bdf00f8 ffff880458331ba8
      [  257.352488] Call Trace:
      [  257.355223]  [<ffffffff8138eef2>] dump_stack+0x19/0x1f
      [  257.360963]  [<ffffffff8102c052>] warn_slowpath_common+0x62/0x7b
      [  257.367669]  [<ffffffff8102c080>] warn_slowpath_null+0x15/0x17
      [  257.374181]  [<ffffffff81032345>] local_bh_enable_ip+0x3c/0x86
      [  257.380697]  [<ffffffff813917fd>] _raw_spin_unlock_bh+0x10/0x12
      [  257.387311]  [<ffffffffa029069c>] iscsit_free_r2ts_from_list+0x5e/0x67 [iscsi_target_mod]
      [  257.396438]  [<ffffffffa02906c5>] iscsit_release_cmd+0x20/0x223 [iscsi_target_mod]
      [  257.404893]  [<ffffffffa02977a4>] lio_release_cmd+0x3a/0x3e [iscsi_target_mod]
      [  257.412964]  [<ffffffffa01d59a1>] target_release_cmd_kref+0x7a/0x7c [target_core_mod]
      [  257.421712]  [<ffffffffa01d69bc>] target_put_sess_cmd+0x5f/0x7f [target_core_mod]
      [  257.430071]  [<ffffffffa01d6d6d>] transport_release_cmd+0x59/0x6f [target_core_mod]
      [  257.438625]  [<ffffffffa01d6eb4>] transport_put_cmd+0x131/0x140 [target_core_mod]
      [  257.446985]  [<ffffffffa01d6192>] ? transport_wait_for_tasks+0xfa/0x1d5 [target_core_mod]
      [  257.456121]  [<ffffffffa01d6f11>] transport_generic_free_cmd+0x4e/0x52 [target_core_mod]
      [  257.465159]  [<ffffffff81050537>] ? __migrate_task+0x110/0x110
      [  257.471674]  [<ffffffffa02904ba>] iscsit_free_cmd+0x46/0x55 [iscsi_target_mod]
      [  257.479741]  [<ffffffffa0291edb>] iscsit_immediate_queue+0x301/0x353 [iscsi_target_mod]
      [  257.488683]  [<ffffffffa0292f7e>] iscsi_target_tx_thread+0x1c6/0x2a8 [iscsi_target_mod]
      [  257.497623]  [<ffffffff81047486>] ? wake_up_bit+0x25/0x25
      [  257.503652]  [<ffffffffa0292db8>] ? iscsit_ack_from_expstatsn+0xd5/0xd5 [iscsi_target_mod]
      [  257.512882]  [<ffffffff81046f89>] kthread+0xb0/0xb8
      [  257.518329]  [<ffffffff81046ed9>] ? kthread_freezable_should_stop+0x60/0x60
      [  257.526105]  [<ffffffff81396fec>] ret_from_fork+0x7c/0xb0
      [  257.532133]  [<ffffffff81046ed9>] ? kthread_freezable_should_stop+0x60/0x60
      [  257.539906] ---[ end trace 5520397d0f2e0800 ]---
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      aafc9d15
  6. 04 5月, 2013 2 次提交
  7. 25 4月, 2013 4 次提交
    • N
      iscsi-target: Refactor TX queue logic + export response PDU creation · 2ec5a8c1
      Nicholas Bellinger 提交于
      This patch refactors TX immediate + response queue handling to use
      the new iscsit_transport API callers, and exports the necessary
      traditional iscsi PDU response creation functions for iser-target
      to utilize.
      
      This includes:
      
      - Add iscsit_build_datain_pdu() for DATAIN PDU init + convert
        iscsit_build_datain_pdu()
      - Add iscsit_build_logout_rsp() for LOGOUT_RSP PDU init + convert
        iscsit_send_logout()
      - Add iscsit_build_nopin_rsp() for NOPIN_RSP PDU init + convert
        iscsit_send_nopin()
      - Add iscsit_build_rsp_pdu() for SCSI_RSP PDU init + convert
        iscsit_send_response()
      - Add iscsit_build_task_mgt_rsp for TM_RSP PDU init + convert
        iscsit_send_task_mgt_rsp()
      - Refactor immediate queue state switch into iscsit_immediate_queue()
      - Convert handle_immediate_queue() to use iscsit_transport caller
      - Refactor response queue state switch into iscsit_response_queue()
      - Convert handle_response_queue to use iscsit_transport caller
      - Export iscsit_logout_post_handler(), iscsit_increment_maxcmdsn()
        and iscsit_tmr_post_handler() for external transport module usage
      
      v5 changes:
      
      - Fix solicited NopIN handling with RDMAExtensions=No (nab)
      
      v3 changes:
      - Add iscsit_build_reject for REJECT PDU init + convert
        iscsit_send_reject()
      
      v2 changes:
      
      - Add iscsit_queue_rsp() for iscsit_transport->iscsit_queue_data_in()
        and iscsit_transport->iscsit_queue_status()
      - Update lio_queue_data_in() to use ->iscsit_queue_data_in()
      - Update lio_queue_status() to use ->iscsit_queue_status()
      - Use mutex_trylock() in iscsit_increment_maxcmdsn()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2ec5a8c1
    • N
      iscsi-target: Refactor RX PDU logic + export request PDU handling · 3e1c81a9
      Nicholas Bellinger 提交于
      This patch refactors existing traditional iscsi RX side PDU handling
      to use iscsit_transport, and exports the necessary logic for external
      transport modules.
      
      This includes:
      
      - Refactor iscsit_handle_scsi_cmd() into PDU setup / processing
      - Add updated iscsit_handle_scsi_cmd() for tradtional iscsi code
      - Add iscsit_set_unsoliticed_dataout() wrapper
      - Refactor iscsit_handle_data_out() into PDU check / processing
      - Add updated iscsit_handle_data_out() for tradtional iscsi code
      - Add iscsit_handle_nop_out() + iscsit_handle_task_mgt_cmd() to
        accept pre-allocated struct iscsi_cmd
      - Add iscsit_build_r2ts_for_cmd() caller for iscsi_target_transport
        to handle ISTATE_SEND_R2T for TX immediate queue
      - Refactor main traditional iscsi iscsi_target_rx_thread() PDU switch
        into iscsi_target_rx_opcode() using iscsit_allocate_cmd()
      - Turn iscsi_target_rx_thread() process context into NOP for
        ib_isert side work-queue.
      
      v5 changes:
      
      - Make iscsit_handle_scsi_cmd() static (Fengguang)
      - Fix iscsit_handle_scsi_cmd() exception se_cmd leak (nab)
      
      v3 changes:
      - Add extra target_put_sess_cmd call in iscsit_add_reject_from_cmd
        after completion
      
      v2 changes:
      
      - Disable iscsit_ack_from_expstatsn() usage for RDMAExtentions=Yes
      - Disable iscsit_allocate_datain_req() usage for RDMAExtentions=Yes
      - Add target_get_sess_cmd() reference counting to
        iscsit_setup_scsi_cmd()
      - Add TFO->lio_check_stop_free() fabric API caller
      - Add export of iscsit_stop_dataout_timer() symbol
      - Add iscsit_build_r2ts_for_cmd() for iscsit_transport->iscsit_get_dataout()
      - Convert existing usage of iscsit_build_r2ts_for_cmd() to
        ->iscsit_get_dataout()
      - Drop RDMAExtentions=Yes specific check in iscsit_build_r2ts_for_cmd()
      - Fix RDMAExtentions -> RDMAExtensions typo (andy)
      - Pass correct dump_payload value into iscsit_get_immediate_data()
        for iscsit_handle_scsi_cmd()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3e1c81a9
    • N
      iscsi-target: Add per transport iscsi_cmd alloc/free · cdb72665
      Nicholas Bellinger 提交于
      This patch converts struct iscsi_cmd memory allocation + free to use
      ->iscsit_alloc_cmd() iscsit_transport API caller, and export
      iscsit_allocate_cmd() symbols
      
      Also add iscsi_cmd->release_cmd() to be used seperately from
      iscsit_transport for connection/session shutdown.
      
      v2 changes:
      
      - Remove unnecessary checks in iscsit_alloc_cmd (asias)
      - Drop iscsit_transport->iscsit_free_cmd() usage
      - Drop iscsit_transport->iscsit_unmap_cmd() usage
      - Add iscsi_cmd->release_cmd()
      - Convert lio_release_cmd() to use iscsi_cmd->release_cmd()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      cdb72665
    • N
      iscsi-target: Initial traditional TCP conversion to iscsit_transport · baa4d64b
      Nicholas Bellinger 提交于
      This patch performs the initial conversion of existing traditional iscsi
      to use iscsit_transport API callers.  This includes:
      
      - iscsi-np cleanups for iscsit_transport_type
      - Add iscsi-np transport calls w/ ->iscsit_setup_up() and ->iscsit_free_np()
      - Convert login thread process context to use ->iscsit_accept_np() for
        connections with pre-allocated struct iscsi_conn
      - Convert existing socket accept code to iscsit_accept_np()
      - Convert login RX/TX callers to use ->iscsit_get_login_rx() and
        ->iscsit_put_login_tx() to exchange request/response PDUs
      - Convert existing socket login RX/TX calls into iscsit_get_login_rx()
        and iscsit_put_login_tx()
      - Change iscsit_close_connection() to invoke ->iscsit_free_conn() +
        iscsit_put_transport() calls.
      - Add iscsit_register_transport() + iscsit_unregister_transport() calls
        to module init/exit
      
      v4 changes:
      
      - Add missing iscsit_put_transport() call in iscsi_target_setup_login_socket()
        failure case
      
      v2 changes:
      
      - Update module init/exit to use register_transport() + unregister_transport()
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      baa4d64b
  8. 28 2月, 2013 2 次提交
  9. 20 2月, 2013 1 次提交
  10. 28 11月, 2012 1 次提交
  11. 08 11月, 2012 1 次提交
  12. 07 11月, 2012 1 次提交
    • C
      target: pass sense_reason as a return value · de103c93
      Christoph Hellwig 提交于
      Pass the sense reason as an explicit return value from the I/O submission
      path instead of storing it in struct se_cmd and using negative return
      values.  This cleans up a lot of the code pathes, and with the sparse
      annotations for the new sense_reason_t type allows for much better
      error checking.
      
      (nab: Convert spc_emulate_modesense + spc_emulate_modeselect to use
            sense_reason_t with Roland's MODE SELECT changes)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      de103c93
  13. 01 11月, 2012 1 次提交
    • R
      iscsi-target: Fix missed wakeup race in TX thread · d5627acb
      Roland Dreier 提交于
      The sleeping code in iscsi_target_tx_thread() is susceptible to the classic
      missed wakeup race:
      
       - TX thread finishes handle_immediate_queue() and handle_response_queue(),
         thinks both queues are empty.
       - Another thread adds a queue entry and does wake_up_process(), which does
         nothing because the TX thread is still awake.
       - TX thread does schedule_timeout() and sleeps forever.
      
      In practice this can kill an iSCSI connection if for example an initiator
      does single-threaded writes and the target misses the wakeup window when
      queueing an R2T; in this case the connection will be stuck until the
      initiator loses patience and does some task management operation (or kills
      the connection entirely).
      
      Fix this by converting to wait_event_interruptible(), which does not
      suffer from this sort of race.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d5627acb
  14. 04 10月, 2012 2 次提交
  15. 03 10月, 2012 4 次提交
  16. 23 9月, 2012 1 次提交
  17. 18 9月, 2012 1 次提交
    • R
      target: Simplify fabric sense data length handling · 9c58b7dd
      Roland Dreier 提交于
      Every fabric driver has to supply a se_tfo->set_fabric_sense_len()
      method, just so iSCSI can return an offset of 2.  However, every fabric
      driver is already allocating a sense buffer and passing it into the
      target core, either via transport_init_se_cmd() or target_submit_cmd().
      
      So instead of having iSCSI pass the start of its sense buffer into the
      core and then later tell the core to skip the first 2 bytes, it seems
      easier for iSCSI just to do the offset of 2 when it passes the sense
      buffer into the core.  Then we can drop the se_tfo->set_fabric_sense_len()
      everywhere, and just add a couple of lines of code to iSCSI to set the
      sense data length to the beginning of the buffer right before it sends
      it over the network.
      
      (nab: Remove .set_fabric_sense_len usage from tcm_qla2xxx_npiv_ops +
            change transport_get_sense_buffer to follow v3.6-rc6 code w/o
            ->set_fabric_sense_len usage)
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9c58b7dd
  18. 21 7月, 2012 1 次提交
    • A
      iscsi-target: Drop bogus struct file usage for iSCSI/SCTP · bf6932f4
      Al Viro 提交于
      From Al Viro:
      
      	BTW, speaking of struct file treatment related to sockets -
              there's this piece of code in iscsi:
              /*
               * The SCTP stack needs struct socket->file.
               */
              if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
                  (np->np_network_transport == ISCSI_SCTP_UDP)) {
                      if (!new_sock->file) {
                              new_sock->file = kzalloc(
                                              sizeof(struct file), GFP_KERNEL);
      
      For one thing, as far as I can see it'not true - sctp does *not* depend on
      socket->file being non-NULL; it does, in one place, check socket->file->f_flags
      for O_NONBLOCK, but there it treats NULL socket->file as "flag not set".
      Which is the case here anyway - the fake struct file created in
      __iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with
      the same excuse) do *not* get that flag set.
      
      Moreover, it's a bloody serious violation of a bunch of asserts in VFS;
      all struct file instances should come from filp_cachep, via get_empty_filp()
      (or alloc_file(), which is a wrapper for it).  FWIW, I'm very tempted to
      do this and be done with the entire mess:
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bf6932f4
  19. 17 7月, 2012 2 次提交
  20. 21 5月, 2012 1 次提交
    • N
      iscsi-target: Fix iov_count calculation bug in iscsit_allocate_iovecs · f80e8ed3
      Nicholas Bellinger 提交于
      This patch fixes a bug in iscsit_allocate_iovecs() where iov_count was
      incorrectly calculated using min(1UL, data_length / PAGE_SIZE) instead of
      max(1UL, data_length / PAGE_SIZE), that ends up triggering an OOPs for
      large block I/O when the SGL <-> iovec mapping exceeds the bogus iov_count
      allocation size.
      
      This is a regression introduced during the iscsi-target conversion back
      to using core memory allocation here:
      
      commit bfb79eac
      Author: Andy Grover <agrover@redhat.com>
      Date:   Tue Apr 3 15:51:29 2012 -0700
      
          target/iscsi: Go back to core allocating data buffer for cmd
      
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f80e8ed3
  21. 15 4月, 2012 8 次提交