[stgt] [PATCH 00/12] Fix Thread per target feature

Chandra Seetharaman sekharan at us.ibm.com
Mon Sep 27 23:06:30 CEST 2010

Hello All,

This is the resend of the same patches that I sent yesterday with
the changes to make sure that these apply cleanly to the current
git tree.

I used dbench (http://dbench.samba.org/web/download.html) as the 

target node was serving 20 targets with names stgt_targets.1:01,
stgt_targets.2:01 ... stgt_targets.20:01

I used the following script as "test_dbench 50"

============ test_dbench script ============
if [[ $# -eq 1 ]];

while :
	while [[ $i -le 20 ]]
		dbench --backend=iscsi --loadfile=/root/bin/iscsi.txt \
			--iscsi-portal= --iscsi-target=$target \
			--iscsi-lun=1 --timelimit=5 $num_procs &
		echo started dbench on target $target $i
============== end of test_dbench_script ===========

============== start of iscsi.txt ===============
0.000 READ10    0 2 0 0 0x00
0.000 READ10    2 2 0 0 0x00
0.000 READ10    4 2 0 0 0x00
0.000 READ10    6 2 0 0 0x00
0.000 READ10    * 2 0 0 0x00
0.000 READCAPACITY10 0 0 0x00
=============== end of iscsi.txt ==================

I started looking at the thread per target issue recently since Tomo
pulled it off for stability issues. When I started looking at it, Tomo
suggested that the problem could most likely be in the context of
disconnects. I started with that suggestion.

I started testing the feature with dbench's iscsi feature. I used 20
targets built on ramdisk file system and used 50 initiators from dbench. I
made the tests run for 5 seconds per iteration. Basically 50 initators
connecting to 20 targets each, run tests for 5 seconds and disconnect,
the same thing iterates forever (or till it dies :).

When I started the tests with the code that was pulled off, tgtd would
segfault and die in 3-5 minutes. Debugging more and more, I found most
 of the issues were race.

Mainly, I found 3 issues,

 - tgt_events_list (global) needed protection
 - it_nexus_list (in struct target) needed protection
 - setting of tcp_conn->pthread to 1 in iscsi_tcp_conn_nexus_init()
   need to happen before do_tgt_event_add().

In the process of understanding the patch and locating the issue, I ended
up splitting Tomo's original patches into multiple small patches by
separting the patches to incorporate simple changes each, and now have a net
of 12 patches :)

IOW, these set of patches are same as Tomo's original 3 patches except the
main 3 changes mentioned above :), (Note that there may be some simple
fixes too).

This set of patches with 1.0.8 ran the same dbench tests for over 24 hours.

Please go thru them and provide me your comments.

Thanks & Regards,

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list