1. 16 6月, 2015 1 次提交
    • N
      target: Drop unnecessary core_tpg_register TFO parameter · bc0c94b1
      Nicholas Bellinger 提交于
      This patch drops unnecessary target_core_fabric_ops parameter usage
      for core_tpg_register() during fabric driver TFO->fabric_make_tpg()
      se_portal_group creation callback execution.
      
      Instead, use the existing se_wwn->wwn_tf->tf_ops pointer to ensure
      fabric driver is really using the same TFO provided at module_init
      time.
      
      Also go ahead and drop the forward TFO declarations tree-wide, and
      handling the special case for iscsi-target discovery TPG.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bc0c94b1
  2. 01 6月, 2015 1 次提交
    • N
      target: Convert se_portal_group->tpg_lun_list[] to RCU hlist · 6bb82612
      Nicholas Bellinger 提交于
      This patch converts the fixed size se_portal_group->tpg_lun_list[]
      to use modern RCU with hlist_head in order to support an arbitary
      number of se_lun ports per target endpoint.
      
      It includes dropping core_tpg_alloc_lun() from core_dev_add_lun(),
      and calling it directly from target_fabric_make_lun() to allocate
      a new se_lun.  And add a new target_fabric_port_release() configfs
      item callback to invoke kfree_rcu() to release memory during
      se_lun->lun_group shutdown.
      
      Also now that se_node_acl->lun_entry_hlist is using RCU, convert
      existing tpg_lun_lock to struct mutex so core_tpg_add_node_to_devs()
      can perform RCU updater logic without releasing ->tpg_lun_mutex.
      
      Also, drop core_tpg_clear_object_luns() and it's single consumer
      in iscsi-target, which is duplicating TPG LUN shutdown logic and
      is current code results in a NOP.
      
      Finally, sbp-target and xen-scsiback fabric driver conversions are
      included, which are required due to the non-standard way they use
      ->tpg_lun_hlist.
      Reviewed-by: NHannes 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>
      Cc: Chris Boot <bootc@bootc.net>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6bb82612
  3. 31 5月, 2015 11 次提交
  4. 20 5月, 2015 1 次提交
  5. 03 5月, 2015 1 次提交
  6. 15 4月, 2015 1 次提交
    • C
      target: simplify the target template registration API · 9ac8928e
      Christoph Hellwig 提交于
      Instead of calling target_fabric_configfs_init() +
      target_fabric_configfs_register() / target_fabric_configfs_deregister()
      target_fabric_configfs_free() from every target driver, rewrite the API
      so that we have simple register/unregister functions that operate on
      a const operations vector.
      
      This patch also fixes a memory leak in several target drivers. Several
      target drivers namely called target_fabric_configfs_deregister()
      without calling target_fabric_configfs_free().
      
      A large part of this patch is based on earlier changes from
      Bart Van Assche <bart.vanassche@sandisk.com>.
      
      (v2: Add a new TF_CIT_SETUP_DRV macro so that the core configfs code
      can declare attributes as either core only or for drivers)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9ac8928e
  7. 11 4月, 2015 1 次提交
    • M
      iscsi target: fix oops when adding reject pdu · b815fc12
      Mike Christie 提交于
      This fixes a oops due to a double list add when adding a reject PDU for
      iscsit_allocate_iovecs allocation failures. The cmd has already been
      added to the conn_cmd_list in iscsit_setup_scsi_cmd, so this has us call
      iscsit_reject_cmd.
      
      Note that for ERL0 the reject PDU is not actually sent, so this patch
      is not completely tested. Just verified we do not oops. The problem is the
      add reject functions return -1 which is returned all the way up to
      iscsi_target_rx_thread which for ERL0 will drop the connection.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b815fc12
  8. 08 4月, 2015 2 次提交
  9. 27 3月, 2015 3 次提交
  10. 21 3月, 2015 1 次提交
  11. 20 3月, 2015 2 次提交
  12. 07 3月, 2015 1 次提交
  13. 13 2月, 2015 3 次提交
    • N
      iscsi-target: Avoid IN_LOGOUT failure case for iser-target · 72859d91
      Nicholas Bellinger 提交于
      This patch addresses a bug reported during iser-target login/logout
      stress testing, where iscsit_take_action_for_connection_exit() is
      incorrectly invoking iscsit_close_connection() twice during IN_LOGOUT
      state, after connection shutdown has already been initiated by
      iser-target code.
      
      Here is the backtrace:
      
      BUG: unable to handle kernel NULL pointer dereference at 00000000000001f0
      IP: [<ffffffffa033d992>] iscsit_take_action_for_connection_exit+0x62/0x110 [iscsi_target_mod]
      PGD 0
      Oops: 0000 [#1] SMP
      Modules linked in: target_core_pscsi(O) target_core_file(O) target_core_iblock(O) ib_isert(O) iscsi_target_mod(O) ib_srpt(O) tcm_loop(O) tcm_fc(O) target_core_mod(O) mst_pciconf(OE) bonding mlx5_ib(O) mlx5_core libfc scsi_transport_fc netconsole configfs nfsv3 nfs_acl mlx4_ib(O) rdma_ucm(O) ib_ucm(O) rdma_cm(O) iw_cm(O) ib_uverbs(O) libiscsi_tcp libiscsi scsi_transport_iscsi mlx4_en mlx4_core ib_ipoib(O) ib_cm(O) ib_sa(O) ib_umad(O) ib_mad(O) ib_core(O) ib_addr(O) rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs fscache lockd grace autofs4 sunrpc 8021q garp stp llc ipv6 dm_mirror dm_region_hash dm_log dm_multipath uinput ipmi_si ipmi_msghandler acpi_pad iTCO_wdt iTCO_vendor_support dcdbas microcode pcspkr wmi sb_edac edac_core sg lpc_ich mfd_core shpchp tg3 ptp pps_core dm_mod ext3(E) jbd(E) mbcache(E) sr_mod(E) cdrom(E) sd_mod(E) ahci(E) libahci(E) megaraid_sas(E) [last unloaded: target_core_mod]
      CPU: 2 PID: 5280 Comm: iscsi_ttx Tainted: G        W  OE  3.18.0-rc2+ #22
      Hardware name: Dell Inc. PowerEdge R720/0VWT90, BIOS 2.0.9 03/08/2013
      task: ffff8806132f9010 ti: ffff880601d6c000 task.ti: ffff880601d6c000
      RIP: 0010:[<ffffffffa033d992>] [<ffffffffa033d992>] iscsit_take_action_for_connection_exit+0x62/0x110 [iscsi_target_mod]
      RSP: 0018:ffff880601d6fe18  EFLAGS: 00010296
      RAX: 0000000000000000 RBX: ffff8805dc437800 RCX: 0000000000000006
      RDX: 0000000000000000 RSI: 0000000000000200 RDI: ffffffffa033d98b
      RBP: ffff880601d6fe28 R08: 0000000000000000 R09: 000000000000dd37
      R10: 00000000ec5d4202 R11: 0000000000000001 R12: ffff8805dc437bf4
      R13: ffff88061b831600 R14: ffff880601d6fe58 R15: ffff8806132f9010
      FS:  0000000000000000(0000) GS:ffff88032fa20000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000001f0 CR3: 0000000001a14000 CR4: 00000000000407e0
      Stack:
      ffff8805dc437800 fffffffffffffe00 ffff880601d6feb8 ffffffffa034ed40
      ffff8806132f9010 ffff880601d6fe70 0f00000000000000 ffff8805d51fbef0
      0000000000000000 ffff8806132f9010 ffffffff8108e7f0 ffff880601d6fe70
      Call Trace:
      [<ffffffffa034ed40>] iscsi_target_tx_thread+0x160/0x220 [iscsi_target_mod]
      [<ffffffff8108e7f0>] ? bit_waitqueue+0xb0/0xb0
      [<ffffffffa034ebe0>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
      [<ffffffff8107017e>] kthread+0xce/0xf0
      [<ffffffff810700b0>] ? kthread_freezable_should_stop+0x70/0x70
      [<ffffffff815a0b6c>] ret_from_fork+0x7c/0xb0
      [<ffffffff810700b0>] ? kthread_freezable_should_stop+0x70/0x70
      Code: 06 0f 84 82 00 00 00 3c 08 74 4e f6 05 39 e6 02 00 04 0f 85 9e 00 00 00 c6 43 19 08 4c 89 e7 e8 65 2a 26 e1 48 8b 83 a0 04 00 00 <48> 8b 88 f0 01 00 00 80 b9 d8 04 00 00 02 74 2e f6 05 31 e6 02
      RIP  [<ffffffffa033d992>] iscsit_take_action_for_connection_exit+0x62/0x110 [iscsi_target_mod]
      RSP <ffff880601d6fe18>
      CR2: 00000000000001f0
      ---[ end trace a0c33436cd0836b4 ]---
      
      This special case is still required by ISCSI_TCP transport during a
      iscsit_handle_logout_cmd() failure case in iscsi_target_rx_opcode(),
      but must be avoided for iser-target.
      Reported-by: NSagi Grimberg <sagig@mellanox.com>
      Reported-by: NSlava Shwartsman <valyushash@gmail.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Slava Shwartsman <valyushash@gmail.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      72859d91
    • N
      iscsi-target: Drop problematic active_ts_list usage · 3fd7b60f
      Nicholas Bellinger 提交于
      This patch drops legacy active_ts_list usage within iscsi_target_tq.c
      code.  It was originally used to track the active thread sets during
      iscsi-target shutdown, and is no longer used by modern upstream code.
      
      Two people have reported list corruption using traditional iscsi-target
      and iser-target with the following backtrace, that appears to be related
      to iscsi_thread_set->ts_list being used across both active_ts_list and
      inactive_ts_list.
      
      [   60.782534] ------------[ cut here ]------------
      [   60.782543] WARNING: CPU: 0 PID: 9430 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0()
      [   60.782545] list_del corruption, ffff88045b00d180->next is LIST_POISON1 (dead000000100100)
      [   60.782546] Modules linked in: ib_srpt tcm_qla2xxx qla2xxx tcm_loop tcm_fc libfc scsi_transport_fc scsi_tgt ib_isert rdma_cm iw_cm ib_addr iscsi_target_mod target_core_pscsi target_core_file target_core_iblock target_core_mod configfs ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables bridge stp llc autofs4 sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 ib_ipoib ib_cm ib_uverbs ib_umad mlx4_en mlx4_ib ib_sa ib_mad ib_core mlx4_core dm_mirror dm_region_hash dm_log dm_mod vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt iTCO_vendor_support microcode serio_raw pcspkr sb_edac edac_core sg i2c_i801 lpc_ich mfd_core mtip32xx igb i2c_algo_bit i2c_core ptp pps_core ioatdma dca wmi ext3(F) jbd(F) mbcache(F) sd_mod(F) crc_t10dif(F) crct10dif_common(F) ahci(F) libahci(F) isci(F) libsas(F) scsi_transport_sas(F) [last unloaded: speedstep_lib]
      [   60.782597] CPU: 0 PID: 9430 Comm: iscsi_ttx Tainted: GF 3.12.19+ #2
      [   60.782598] Hardware name: Supermicro X9DRX+-F/X9DRX+-F, BIOS 3.00 07/09/2013
      [   60.782599]  0000000000000035 ffff88044de31d08 ffffffff81553ae7 0000000000000035
      [   60.782602]  ffff88044de31d58 ffff88044de31d48 ffffffff8104d1cc 0000000000000002
      [   60.782605]  ffff88045b00d180 ffff88045b00d0c0 ffff88045b00d0c0 ffff88044de31e58
      [   60.782607] Call Trace:
      [   60.782611]  [<ffffffff81553ae7>] dump_stack+0x49/0x62
      [   60.782615]  [<ffffffff8104d1cc>] warn_slowpath_common+0x8c/0xc0
      [   60.782618]  [<ffffffff8104d2b6>] warn_slowpath_fmt+0x46/0x50
      [   60.782620]  [<ffffffff81280933>] __list_del_entry+0x63/0xd0
      [   60.782622]  [<ffffffff812809b1>] list_del+0x11/0x40
      [   60.782630]  [<ffffffffa06e7cf9>] iscsi_del_ts_from_active_list+0x29/0x50 [iscsi_target_mod]
      [   60.782635]  [<ffffffffa06e87b1>] iscsi_tx_thread_pre_handler+0xa1/0x180 [iscsi_target_mod]
      [   60.782642]  [<ffffffffa06fb9ae>] iscsi_target_tx_thread+0x4e/0x220 [iscsi_target_mod]
      [   60.782647]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
      [   60.782652]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
      [   60.782655]  [<ffffffff8106f99e>] kthread+0xce/0xe0
      [   60.782657]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
      [   60.782660]  [<ffffffff8156026c>] ret_from_fork+0x7c/0xb0
      [   60.782662]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
      [   60.782663] ---[ end trace 9662f4a661d33965 ]---
      
      Since this code is no longer used, go ahead and drop the problematic usage
      all-together.
      Reported-by: NGavin Guo <gavin.guo@canonical.com>
      Reported-by: NMoussa Ba <moussaba@micron.com>
      Cc: stable@vger.kernel.org # 3.1+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3fd7b60f
    • S
      iscsi/iser-target: Support multi-sequence sendtargets text response · e4f4e801
      Sagi Grimberg 提交于
      In case sendtargets response is larger than initiator MRDSL, we
      send a partial sendtargets response (setting F=0, C=1, TTT!=0xffffffff),
      accept a consecutive empty text message and send the rest of the payload.
      In case we are done, we set F=1, C=0, TTT=0xffffffff.
      We do that by storing the sendtargets response bytes done under
      the session.
      
      This patch also makes iscsit_find_cmd_from_itt public for isert.
      
      (Re-add cmd->maxcmdsn_inc and clear in iscsit_build_text_rsp - nab)
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e4f4e801
  14. 05 2月, 2015 2 次提交
  15. 31 1月, 2015 1 次提交
  16. 16 1月, 2015 1 次提交
  17. 10 1月, 2015 1 次提交
  18. 16 12月, 2014 2 次提交
    • N
      iscsi-target: Fail connection on short sendmsg writes · 6bf6ca75
      Nicholas Bellinger 提交于
      This patch changes iscsit_do_tx_data() to fail on short writes
      when kernel_sendmsg() returns a value different than requested
      transfer length, returning -EPIPE and thus causing a connection
      reset to occur.
      
      This avoids a potential bug in the original code where a short
      write would result in kernel_sendmsg() being called again with
      the original iovec base + length.
      
      In practice this has not been an issue because iscsit_do_tx_data()
      is only used for transferring 48 byte headers + 4 byte digests,
      along with seldom used control payloads from NOPIN + TEXT_RSP +
      REJECT with less than 32k of data.
      
      So following Al's audit of iovec consumers, go ahead and fail
      the connection on short writes for now, and remove the bogus
      logic ahead of his proper upstream fix.
      Reported-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6bf6ca75
    • S
      iscsi-target: nullify session in failed login sequence · a0b3b9b2
      Sagi Grimberg 提交于
      In case login sequence failed, make sure conn->sess is
      NULL before calling wait_conn as some transports (iser)
      may rely on that (waiting for session commands).
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a0b3b9b2
  19. 13 12月, 2014 3 次提交
  20. 10 12月, 2014 1 次提交
    • A
      switch memcpy_to_msg() and skb_copy{,_and_csum}_datagram_msg() to primitives · e5a4b0bb
      Al Viro 提交于
      ... making both non-draining.  That means that tcp_recvmsg() becomes
      non-draining.  And _that_ would break iscsit_do_rx_data() unless we
      	a) make sure tcp_recvmsg() is uniformly non-draining (it is)
      	b) make sure it copes with arbitrary (including shifted)
      iov_iter (it does, all it uses is iov_iter primitives)
      	c) make iscsit_do_rx_data() initialize ->msg_iter only once.
      
      Fortunately, (c) is doable with minimal work and we are rid of one
      the two places where kernel send/recvmsg users would be unhappy with
      non-draining behaviour.
      
      Actually, that makes all but one of ->recvmsg() instances iov_iter-clean.
      The exception is skcipher_recvmsg() and it also isn't hard to convert
      to primitives (iov_iter_get_pages() is needed there).  That'll wait
      a bit - there's some interplay with ->sendmsg() path for that one.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e5a4b0bb