<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/target/iscsi/iscsi_target_util.h, branch next</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=next</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=next'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2014-04-07T08:48:51+00:00</updated>
<entry>
<title>target: Add TFO-&gt;abort_task for aborted task resources release</title>
<updated>2014-04-07T08:48:51+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2014-03-22T21:55:56+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=131e6abc674edb9f9a59090bb35bf6650569b7e7'/>
<id>urn:sha1:131e6abc674edb9f9a59090bb35bf6650569b7e7</id>
<content type='text'>
Now that TASK_ABORTED status is not generated for all cases by
TMR ABORT_TASK + LUN_RESET, a new TFO-&gt;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-&gt;release_cmd() codepath.

This patch adds TFO-&gt;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 -&gt;aborted_task() are:

  - iscsi-target
  - iser-target
  - srpt
  - tcm_qla2xxx

The fabric drivers that currently set -&gt;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-&gt;release_cmd() to release the
se_cmd descriptor.

v2 changes:
  - Move -&gt;aborted_task() call into transport_cmd_finish_abort (Alex)

Cc: Alex Leung &lt;amleung21@yahoo.com&gt;
Cc: Mark Rustad &lt;mark.d.rustad@intel.com&gt;
Cc: Roland Dreier &lt;roland@kernel.org&gt;
Cc: Vu Pham &lt;vu@mellanox.com&gt;
Cc: Chris Boot &lt;bootc@bootc.net&gt;
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Cc: Giridhar Malavali &lt;giridhar.malavali@qlogic.com&gt;
Cc: Saurav Kashyap &lt;saurav.kashyap@qlogic.com&gt;
Cc: Quinn Tran &lt;quinn.tran@qlogic.com&gt;
Cc: Sagi Grimberg &lt;sagig@mellanox.com&gt;
Cc: Or Gerlitz &lt;ogerlitz@mellanox.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsi-target: Convert gfp_t parameter to task state bitmask</title>
<updated>2014-01-25T06:58:52+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2014-01-20T03:36:44+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=676687c69697d2081d25afd14ee90937d1fb0c8e'/>
<id>urn:sha1:676687c69697d2081d25afd14ee90937d1fb0c8e</id>
<content type='text'>
This patch propigates the use of task state bitmask now used by
percpu_ida_alloc() up the iscsi-target callchain, replacing the
use of GFP_ATOMIC for TASK_RUNNING, and GFP_KERNEL for
TASK_INTERRUPTIBLE.

Also, drop the unnecessary gfp_t parameter to isert_allocate_cmd(),
and just pass TASK_INTERRUPTIBLE into iscsit_allocate_cmd().

Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsi-target: Fix iscsit_sequence_cmd reject handling for iser</title>
<updated>2013-07-07T04:59:54+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2013-07-03T10:58:58+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=561bf15892375597ee59d473a704a3e634c4f311'/>
<id>urn:sha1:561bf15892375597ee59d473a704a3e634c4f311</id>
<content type='text'>
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 &lt;ogerlitz@mellanox.com&gt;
Cc: Mike Christie &lt;michaelc@cs.wisc.edu&gt;
Cc: stable@vger.kernel.org  # 3.10+
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsi-target: Fix iscsit_free_cmd() se_cmd-&gt;cmd_kref shutdown handling</title>
<updated>2013-05-31T08:21:28+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2013-05-31T07:49:41+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=aafc9d158b0039e600fc429246c7bb04a111fb26'/>
<id>urn:sha1:aafc9d158b0039e600fc429246c7bb04a111fb26</id>
<content type='text'>
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-&gt;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() -&gt; 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 3e1c81a95, 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]  [&lt;ffffffff8138eef2&gt;] dump_stack+0x19/0x1f
[  257.360963]  [&lt;ffffffff8102c052&gt;] warn_slowpath_common+0x62/0x7b
[  257.367669]  [&lt;ffffffff8102c080&gt;] warn_slowpath_null+0x15/0x17
[  257.374181]  [&lt;ffffffff81032345&gt;] local_bh_enable_ip+0x3c/0x86
[  257.380697]  [&lt;ffffffff813917fd&gt;] _raw_spin_unlock_bh+0x10/0x12
[  257.387311]  [&lt;ffffffffa029069c&gt;] iscsit_free_r2ts_from_list+0x5e/0x67 [iscsi_target_mod]
[  257.396438]  [&lt;ffffffffa02906c5&gt;] iscsit_release_cmd+0x20/0x223 [iscsi_target_mod]
[  257.404893]  [&lt;ffffffffa02977a4&gt;] lio_release_cmd+0x3a/0x3e [iscsi_target_mod]
[  257.412964]  [&lt;ffffffffa01d59a1&gt;] target_release_cmd_kref+0x7a/0x7c [target_core_mod]
[  257.421712]  [&lt;ffffffffa01d69bc&gt;] target_put_sess_cmd+0x5f/0x7f [target_core_mod]
[  257.430071]  [&lt;ffffffffa01d6d6d&gt;] transport_release_cmd+0x59/0x6f [target_core_mod]
[  257.438625]  [&lt;ffffffffa01d6eb4&gt;] transport_put_cmd+0x131/0x140 [target_core_mod]
[  257.446985]  [&lt;ffffffffa01d6192&gt;] ? transport_wait_for_tasks+0xfa/0x1d5 [target_core_mod]
[  257.456121]  [&lt;ffffffffa01d6f11&gt;] transport_generic_free_cmd+0x4e/0x52 [target_core_mod]
[  257.465159]  [&lt;ffffffff81050537&gt;] ? __migrate_task+0x110/0x110
[  257.471674]  [&lt;ffffffffa02904ba&gt;] iscsit_free_cmd+0x46/0x55 [iscsi_target_mod]
[  257.479741]  [&lt;ffffffffa0291edb&gt;] iscsit_immediate_queue+0x301/0x353 [iscsi_target_mod]
[  257.488683]  [&lt;ffffffffa0292f7e&gt;] iscsi_target_tx_thread+0x1c6/0x2a8 [iscsi_target_mod]
[  257.497623]  [&lt;ffffffff81047486&gt;] ? wake_up_bit+0x25/0x25
[  257.503652]  [&lt;ffffffffa0292db8&gt;] ? iscsit_ack_from_expstatsn+0xd5/0xd5 [iscsi_target_mod]
[  257.512882]  [&lt;ffffffff81046f89&gt;] kthread+0xb0/0xb8
[  257.518329]  [&lt;ffffffff81046ed9&gt;] ? kthread_freezable_should_stop+0x60/0x60
[  257.526105]  [&lt;ffffffff81396fec&gt;] ret_from_fork+0x7c/0xb0
[  257.532133]  [&lt;ffffffff81046ed9&gt;] ? kthread_freezable_should_stop+0x60/0x60
[  257.539906] ---[ end trace 5520397d0f2e0800 ]---

Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsi-target: Add per transport iscsi_cmd alloc/free</title>
<updated>2013-04-25T08:05:27+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2013-03-07T06:09:17+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=cdb726651c357c19c02b17ee3c99a224b03022b6'/>
<id>urn:sha1:cdb726651c357c19c02b17ee3c99a224b03022b6</id>
<content type='text'>
This patch converts struct iscsi_cmd memory allocation + free to use
-&gt;iscsit_alloc_cmd() iscsit_transport API caller, and export
iscsit_allocate_cmd() symbols

Also add iscsi_cmd-&gt;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-&gt;iscsit_free_cmd() usage
- Drop iscsit_transport-&gt;iscsit_unmap_cmd() usage
- Add iscsi_cmd-&gt;release_cmd()
- Convert lio_release_cmd() to use iscsi_cmd-&gt;release_cmd()

Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsi-target: Fix missed wakeup race in TX thread</title>
<updated>2012-11-01T07:38:44+00:00</updated>
<author>
<name>Roland Dreier</name>
<email>roland@purestorage.com</email>
</author>
<published>2012-10-31T16:16:46+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d5627acba9ae584cf4928af19f7ddf5f6837de32'/>
<id>urn:sha1:d5627acba9ae584cf4928af19f7ddf5f6837de32</id>
<content type='text'>
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: Roland Dreier &lt;roland@purestorage.com&gt;
Cc: Andy Grover &lt;agrover@redhat.com&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsit: proper endianess conversions</title>
<updated>2012-10-03T21:39:22+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@infradead.org</email>
</author>
<published>2012-09-26T12:00:40+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=50e5c87de4c244662e47b28e499ace885d62248f'/>
<id>urn:sha1:50e5c87de4c244662e47b28e499ace885d62248f</id>
<content type='text'>
Make sure all on the wire types are use as big endian and big endian only so
that sparse can verify all the conversions are done right.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>iscsit: use the itt_t abstract type</title>
<updated>2012-10-03T21:21:50+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@infradead.org</email>
</author>
<published>2012-09-26T12:00:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=66c7db687631247b7a3493322b9aedeef3c6c7b5'/>
<id>urn:sha1:66c7db687631247b7a3493322b9aedeef3c6c7b5</id>
<content type='text'>
Use the special itt_t type defined by the iscsi headers and the initiator
to make sure it's an opaque value.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/iscsi: Fold _decide_list_to_build into _build_pdu_and_seq_lists</title>
<updated>2012-04-15T00:40:38+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:25+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=4334e49bcae6f4602eb5c52158b8fb89d8941d99'/>
<id>urn:sha1:4334e49bcae6f4602eb5c52158b8fb89d8941d99</id>
<content type='text'>
Rename iscsit_build_pdu_and_seq_list to iscsit_do_build_pdu_and_seq_lists

Rename iscsit_do_build_list to iscsit_build_pdu_and_seq_lists

Move code from iscsit_decide_list_to_build into _seq_pdu_list.c, seems
a better fit.

Also update some comments in pdu/seq code for correctness and whitespace.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/iscsi: Inline iscsit_allocate_se_cmd and *_for_tmr</title>
<updated>2012-04-15T00:40:37+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:22+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d28b11692e6ec577cec70606d793e14843124a03'/>
<id>urn:sha1:d28b11692e6ec577cec70606d793e14843124a03</id>
<content type='text'>
Trying to move a bunch of stuff around so iscsi can use target_submit_cmd
someday, and so stuff needs to be in that function directly instead of
hidden, so it can be reordered etc.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
</feed>
