From nobody@FreeBSD.org  Sat Jun 11 14:16:26 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 681B11065674
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Jun 2011 14:16:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 57D3B8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Jun 2011 14:16:26 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5BEGPbj059214
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Jun 2011 14:16:25 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5BEGP0R059213;
	Sat, 11 Jun 2011 14:16:25 GMT
	(envelope-from nobody)
Message-Id: <201106111416.p5BEGP0R059213@red.freebsd.org>
Date: Sat, 11 Jun 2011 14:16:25 GMT
From: Martin Birgmeier <martin.birgmeier@aon.at>
To: freebsd-gnats-submit@FreeBSD.org
Subject: iscsi_initiator panic
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157770
>Category:       kern
>Synopsis:       [iscsi] [panic] iscsi_initiator panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jpaetzel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 11 14:20:05 UTC 2011
>Closed-Date:    Sun Apr 14 22:54:49 UTC 2013
>Last-Modified:  Sun Apr 14 22:54:49 UTC 2013
>Originator:     Martin Birgmeier
>Release:        8.2 amd64
>Organization:
MBi at home
>Environment:
FreeBSD hal.xyzzy 8.2-RELEASE FreeBSD 8.2-RELEASE #1: Sun Feb 20 17:29:54 CET 2011     root@hal.xyzzy:/z/OBJ/FreeBSD/amd64/RELENG_8_2_0_RELEASE/src/sys/XYZZY_SMP  amd64
>Description:
The setup involves an iSCSI target server ("hal"), using ports/net/istgt. The target disks are on a ZFS volume as plain files. This works fine with an initiator on a Windows XP client (using Microsoft iSCSI Software Initiator Version 2.08).

The next step was to use the same machine also as an iSCSI initiator. For this, I loaded iscsi_initiator via kldload.

Then I executed "iscontrol -d -t hal.xyzzy" several times, because initially it did not succeed due to parameter problems ("FirstBurstLength(262144) > MaxBurstLength(131072)").

During the execution of these commands, the system became very unresponsive. System load did not increase, however. "systat -vm 1" paused intermittently for several seconds. Because of the parameter problem, the "iscontrol" command would not succeed, but instead hang non-interruptibly until some timeout. After the timeout, the machine seemed to become somewhat more responsive again.

After fixing the iscsi configuration, the above iscontrol command succeeded, printing the available targets.

Shortly afterwards, the machine paniced. I have included a kgdb output as an attachment.
>How-To-Repeat:
Presumably using the same sequence of commands - which I do not want to try, as this is a production server.
>Fix:


Patch attached with submission follows:

[0]# cd /var/crash
[0]# kgdb /boot/kernel/kernel vmcore.2 
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...

Unread portion of the kernel message buffer:


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x308
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff8024c0be
stack pointer           = 0x28:0xffffff8476358aa0
frame pointer           = 0x28:0xffffff8476358ac0
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 23976 (isc_out 0)
trap number             = 12
panic: page fault
cpuid = 0
Uptime: 8h3m47s
Physical memory: 16115 MB
Dumping 12162 MB: 12147 12131 12115 12099 12083 12067 12051 12035 12019 12003 11987 11971 11955 11939 11923 11907 11891 11875 11859 11843 11827 11811 11795 11779 11763 11747 11731 11715 11699 11683 11667 11651 11635 11619 11603 11587 11571 11555 11539 11523 11507 11491 11475 11459 11443 11427 11411 11395 11379 11363 11347 11331 11315 11299 11283 11267 11251 11235 11219 11203 11187 11171 11155 11139 11123 11107 11091 11075 11059 11043 11027 11011 10995 10979 10963 10947 10931 10915 10899 10883 10867 10851 10835 10819 10803 10787 10771 10755 10739 10723 10707 10691 10675 10659 10643 10627 10611 10595 10579 10563 10547 10531 10515 10499 10483 10467 10451 10435 10419 10403 10387 10371 10355 10339 10323 10307 10291 10275 10259 10243 10227 10211 10195 10179 10163 10147 10131 10115 10099 10083 10067 10051 10035 10019 10003 9987 9971 9955 9939 9923 9907 9891 9875 9859 9843 9827 9811 9795 9779 9763 9747 9731 9715 9699 9683 9667 9651 9635 9619 9603 9587 9571 9555 9539 9523 9507 9491 94
 75 9459 9443 9427 9411 9395 9379 9363 9347 9331 9315 9299 9283 9267 9251 9235 9219 9203 9187 9171 9155 9139 9123 9107 9091 9075 9059 9043 9027 9011 8995 8979 8963 8947 8931 8915 8899 8883 8867 8851 8835 8819 8803 8787 8771 8755 8739 8723 8707 8691 8675 8659 8643 8627 8611 8595 8579 8563 8547 8531 8515 8499 8483 8467 8451 8435 8419 8403 8387 8371 8355 8339 8323 8307 8291 8275 8259 8243 8227 8211 8195 8179 8163 8147 8131 8115 8099 8083 8067 8051 8035 8019 8003 7987 7971 7955 7939 7923 7907 7891 7875 7859 7843 7827 7811 7795 7779 7763 7747 7731 7715 7699 7683 7667 7651 7635 7619 7603 7587 7571 7555 7539 7523 7507 7491 7475 7459 7443 7427 7411 7395 7379 7363 7347 7331 7315 7299 7283 7267 7251 7235 7219 7203 7187 7171 7155 7139 7123 7107 7091 7075 7059 7043 7027 7011 6995 6979 6963 6947 6931 6915 6899 6883 6867 6851 6835 6819 6803 6787 6771 6755 6739 6723 6707 6691 6675 6659 6643 6627 6611 6595 6579 6563 6547 6531 6515 6499 6483 6467 6451 6435 6419 6403 6387 6371 6355 6339 6323 6
 307 6291 6275 6259 6243 6227 6211 6195 6179 6163 6147 6131 6!
 115 6099 6083 6067 6051 6035 6019 6003 5987 5971 5955 5939 5923 5907 5891 5875 5859 5843 5827 5811 5795 5779 5763 5747 5731 5715 5699 5683 5667 5651 5635 5619 5603 5587 5571 5555 5539 5523 5507 5491 5475 5459 5443 5427 5411 5395 5379 5363 5347 5331 5315 5299 5283 5267 5251 5235 5219 5203 5187 5171 5155 5139 5123 5107 5091 5075 5059 5043 5027 5011 4995 4979 4963 4947 4931 4915 4899 4883 4867 4851 4835 4819 4803 4787 4771 4755 4739 4723 4707 4691 4675 4659 4643 4627 4611 4595 4579 4563 4547 4531 4515 4499 4483 4467 4451 4435 4419 4403 4387 4371 4355 4339 4323 4307 4291 4275 4259 4243 4227 4211 4195 4179 4163 4147 4131 4115 4099 4083 4067 4051 4035 4019 4003 3987 3971 3955 3939 3923 3907 3891 3875 3859 3843 3827 3811 3795 3779 3763 3747 3731 3715 3699 3683 3667 3651 3635 3619 3603 3587 3571 3555 3539 3523 3507 3491 3475 3459 3443 3427 3411 3395 3379 3363 3347 3331 3315 3299 3283 3267 3251 3235 3219 3203 3187 3171 3155 3139 3123 3107 3091 3075 3059 3043 3027 3011 2995 2979 2963 
 2947 2931 2915 2899 2883 2867 2851 2835 2819 2803 2787 2771 2755 2739 2723 2707 2691 2675 2659 2643 2627 2611 2595 2579 2563 2547 2531 2515 2499 2483 2467 2451 2435 2419 2403 2387 2371 2355 2339 2323 2307 2291 2275 2259 2243 2227 2211 2195 2179 2163 2147 2131 2115 2099 2083 2067 2051 2035 2019 2003 1987 1971 1955 1939 1923 1907 1891 1875 1859 1843 1827 1811 1795 1779 1763 1747 1731 1715 1699 1683 1667 1651 1635 1619 1603 1587 1571 1555 1539 1523 1507 1491 1475 1459 1443 1427 1411 1395 1379 1363 1347 1331 1315 1299 1283 1267 1251 1235 1219 1203 1187 1171 1155 1139 1123 1107 1091 1075 1059 1043 1027 1011 995 979 963 947 931 915 899 883 867 851 835 819 803 787 771 755 739 723 707 691 675 659 643 627 611 595 579 563 547 531 515 499 483 467 451 435 419 403 387 371 355 339 323 307 291 275 259 243 227 211 195 179 163 147 131 115 99 83 67 51 35 19 3

Reading symbols from /boot/kernel/zfs.ko...Reading symbols from /boot/kernel/zfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/zfs.ko
Reading symbols from /boot/kernel/opensolaris.ko...Reading symbols from /boot/kernel/opensolaris.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/opensolaris.ko
Reading symbols from /boot/kernel/geom_label.ko...Reading symbols from /boot/kernel/geom_label.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/geom_label.ko
Reading symbols from /boot/kernel/firewire.ko...Reading symbols from /boot/kernel/firewire.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/firewire.ko
Reading symbols from /boot/kernel/if_re.ko...Reading symbols from /boot/kernel/if_re.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/if_re.ko
Reading symbols from /boot/kernel/miibus.ko...Reading symbols from /boot/kernel/miibus.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/miibus.ko
Reading symbols from /boot/kernel/snd_hda.ko...Reading symbols from /boot/kernel/snd_hda.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/snd_hda.ko
Reading symbols from /boot/kernel/sound.ko...Reading symbols from /boot/kernel/sound.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/sound.ko
Reading symbols from /boot/kernel/usb.ko...Reading symbols from /boot/kernel/usb.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/usb.ko
Reading symbols from /boot/kernel/uhid.ko...Reading symbols from /boot/kernel/uhid.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/uhid.ko
Reading symbols from /boot/kernel/ums.ko...Reading symbols from /boot/kernel/ums.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ums.ko
Reading symbols from /boot/kernel/umass.ko...Reading symbols from /boot/kernel/umass.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/umass.ko
Reading symbols from /boot/kernel/aio.ko...Reading symbols from /boot/kernel/aio.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/aio.ko
Reading symbols from /boot/kernel/agp.ko...Reading symbols from /boot/kernel/agp.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/agp.ko
Reading symbols from /boot/kernel/accf_data.ko...Reading symbols from /boot/kernel/accf_data.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/accf_data.ko
Reading symbols from /boot/kernel/accf_http.ko...Reading symbols from /boot/kernel/accf_http.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/accf_http.ko
Reading symbols from /boot/kernel/random.ko...Reading symbols from /boot/kernel/random.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/random.ko
Reading symbols from /boot/kernel/speaker.ko...Reading symbols from /boot/kernel/speaker.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/speaker.ko
Reading symbols from /boot/kernel/amdtemp.ko...Reading symbols from /boot/kernel/amdtemp.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/amdtemp.ko
Reading symbols from /boot/kernel/ehci.ko...Reading symbols from /boot/kernel/ehci.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ehci.ko
Reading symbols from /boot/kernel/geom_part_gpt.ko...Reading symbols from /boot/kernel/geom_part_gpt.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/geom_part_gpt.ko
Reading symbols from /boot/kernel/intpm.ko...Reading symbols from /boot/kernel/intpm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/intpm.ko
Reading symbols from /boot/kernel/smbus.ko...Reading symbols from /boot/kernel/smbus.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/smbus.ko
Reading symbols from /boot/kernel/ohci.ko...Reading symbols from /boot/kernel/ohci.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ohci.ko
Reading symbols from /boot/kernel/smb.ko...Reading symbols from /boot/kernel/smb.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/smb.ko
Reading symbols from /boot/modules/vboxdrv.ko...done.
Loaded symbols for /boot/modules/vboxdrv.ko
Reading symbols from /boot/kernel/geom_md.ko...Reading symbols from /boot/kernel/geom_md.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/geom_md.ko
Reading symbols from /boot/kernel/procfs.ko...Reading symbols from /boot/kernel/procfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/procfs.ko
Reading symbols from /boot/kernel/pseudofs.ko...Reading symbols from /boot/kernel/pseudofs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/pseudofs.ko
Reading symbols from /boot/kernel/fdescfs.ko...Reading symbols from /boot/kernel/fdescfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/fdescfs.ko
Reading symbols from /boot/modules/vboxnetflt.ko...done.
Loaded symbols for /boot/modules/vboxnetflt.ko
Reading symbols from /boot/kernel/netgraph.ko...Reading symbols from /boot/kernel/netgraph.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/netgraph.ko
Reading symbols from /boot/kernel/ng_ether.ko...Reading symbols from /boot/kernel/ng_ether.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ng_ether.ko
Reading symbols from /boot/modules/vboxnetadp.ko...done.
Loaded symbols for /boot/modules/vboxnetadp.ko
Reading symbols from /boot/kernel/green_saver.ko...Reading symbols from /boot/kernel/green_saver.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/green_saver.ko
Reading symbols from /boot/kernel/radeon.ko...Reading symbols from /boot/kernel/radeon.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/radeon.ko
Reading symbols from /boot/kernel/drm.ko...Reading symbols from /boot/kernel/drm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/drm.ko
Reading symbols from /boot/kernel/iscsi_initiator.ko...Reading symbols from /boot/kernel/iscsi_initiator.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/iscsi_initiator.ko
#0  doadump () at pcpu.h:224
224     pcpu.h: No such file or directory.
        in pcpu.h
(kgdb) where
#0  doadump () at pcpu.h:224
#1  0xffffffff8025b9fe in boot (howto=260) at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/kern_shutdown.c:419
#2  0xffffffff8025be13 in panic (fmt=0x0) at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/kern_shutdown.c:592
#3  0xffffffff8044a42d in trap_fatal (frame=0xffffff02577448c0, eva=Variable "eva" is not available.
)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/amd64/amd64/trap.c:783
#4  0xffffffff8044a7ef in trap_pfault (frame=0xffffff84763589f0, usermode=0)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/amd64/amd64/trap.c:699
#5  0xffffffff8044abef in trap (frame=0xffffff84763589f0)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/amd64/amd64/trap.c:449
#6  0xffffffff80432f54 in calltrap () at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/amd64/amd64/exception.S:224
#7  0xffffffff8024c0be in _mtx_lock_sleep (m=0xffffff0007aeed30, tid=18446742982146670592, opts=Variable "opts" is not available.
)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/kern_mutex.c:369
#8  0xffffffff80264641 in _sleep (ident=Variable "ident" is not available.
) at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/kern_synch.c:243
#9  0xffffffff80cbae28 in ism_out (vp=Variable "vp" is not available.
)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/modules/iscsi/initiator/../../../dev/iscsi/initiator/isc_sm.c:554
#10 0xffffffff80232328 in fork_exit (callout=0xffffffff80cba680 <ism_out>, arg=0xffffff0007aeec00, 
    frame=0xffffff8476358c40) at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/kern_fork.c:845
#11 0xffffffff8043341e in fork_trampoline ()
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/amd64/amd64/exception.S:565
#12 0x0000000000000000 in ?? ()
#13 0x0000000000000000 in ?? ()
#14 0x0000000000000001 in ?? ()
#15 0x0000000000000000 in ?? ()
#16 0x0000000000000000 in ?? ()
#17 0x0000000000000000 in ?? ()
#18 0x0000000000000000 in ?? ()
#19 0x0000000000000000 in ?? ()
#20 0x0000000000000000 in ?? ()
#21 0x0000000000000000 in ?? ()
#22 0x0000000000000000 in ?? ()
#23 0x0000000000000000 in ?? ()
#24 0x0000000000000000 in ?? ()
#25 0x0000000000000000 in ?? ()
#26 0x0000000000000000 in ?? ()
---Type <return> to continue, or q <return> to quit---
#27 0x0000000000000000 in ?? ()
#28 0x0000000000000000 in ?? ()
#29 0x0000000000000000 in ?? ()
#30 0x0000000000000000 in ?? ()
#31 0x0000000000000000 in ?? ()
#32 0x0000000000000000 in ?? ()
#33 0x0000000000000000 in ?? ()
#34 0x0000000000000000 in ?? ()
#35 0x0000000000000000 in ?? ()
#36 0xffffffff80675640 in affinity ()
#37 0x0000000000000000 in ?? ()
#38 0x0000000000000000 in ?? ()
#39 0xffffff01d9c84000 in ?? ()
#40 0xffffff84763580e0 in ?? ()
#41 0xffffff8476358088 in ?? ()
#42 0xffffff000678c8c0 in ?? ()
#43 0xffffffff802810e9 in sched_switch (td=0xffffffff80cba680, newtd=0xffffff0007aeec00, flags=Variable "flags" is not available.
)
    at /z/SRC/FreeBSD/RELENG_8_2_0_RELEASE/src/sys/kern/sched_ule.c:1852
Previous frame inner to this frame (corrupt stack?)
(kgdb) 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-scsi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jun 11 16:05:00 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157770 

From: Erwan Martin <emartin@lanestel.fr>
To: bug-followup@FreeBSD.org, martin.birgmeier@aon.at
Cc:  
Subject: Re: kern/157770: [iscsi] [panic] iscsi_initiator panic
Date: Tue, 21 Jun 2011 13:42:18 +0200

 I'm having the same problem.
 The windows XP initiator works perfectly but iscsi_initiator does not.
 
 The initiator system is:
 FreeBSD fbsd.localdomain 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Jun 10 
 10:17:58 CEST 2011     
 root@fbsd.localdomain:/usr/obj/usr/src/sys/ISCSIKERNEL  i386
 
 On the target:
 Jun 21 11:06:49 hostname istgt[11438]: Login(discovery) from 
 iqn.2011-06.net.example.tests:whatever (192.168.3.205) on449423030, 
 TSIH=4, CID=1, HeaderDigest=off, DataDigest=off
 Jun 21 11:06:49 hostname istgt[11438]: 
 istgt_iscsi.c:1848:istgt_iscsi_check_values: ***ERROR*** 
 FirstBurstLength(262144) > MaxBurstLength(131072)
 Jun 21 11:06:49 hostname istgt[11438]: 
 istgt_iscsi.c:2559:istgt_iscsi_op_login: ***ERROR*** 
 iscsi_check_values() failed
 Jun 21 11:06:49 hostname istgt[11438]: 
 istgt_iscsi.c:4545:istgt_iscsi_execute: ***ERROR*** iscsi_op_login() failed
 Jun 21 11:06:49 hostname istgt[11438]: istgt_iscsi.c:5156:worker: 
 ***ERROR*** iscsi_execute() failed on 
 dummy,t,0x0001(iqual175,i,0x804449423030)
 
 I do not experience any system crash however.
 
 This bug can be repeated on my system.

From: Daniel Braniss <danny@cs.huji.ac.il>
To: bug-followup@FreeBSD.org,
 martin.birgmeier@aon.at
Cc:  
Subject: Re: kern/157770: [iscsi] [panic] iscsi_initiator panic
Date: Wed, 22 Jun 2011 10:12:12 +0300

 There are 2 issues here, and only one causes the panic.
 issue 1: mismatch of negotiated values might cause hangs/panics when =
 trying to kill iscontrol
  this is in my todo list.
 issue 2: somehow -to be investigated- iscontrol and istgt don't =
 negotiate FirstBurstLength and
 MaxBurtsLength correctly. The workaround is either to reduce =
 MaxBurstLength in istgt conf, or
 increase it in iscsi,conf
 
 danny
 

From: Martin Birgmeier <Martin.Birgmeier@aon.at>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/157770: [iscsi] [panic] iscsi_initiator panic
Date: Sat, 01 Sep 2012 17:11:24 +0200

 This could be resolved by merging
 
 r234233 | jpaetzel | 2012-04-13 20:21:56 +0200 (Fri, 13 Apr 2012) | 4 lines
 
 to stable/{7..9} plus the various relengs
 
 Regards,
 
 Martin
 
Responsible-Changed-From-To: freebsd-scsi->jpaetzel 
Responsible-Changed-By: sbruno 
Responsible-Changed-When: Thu Apr 11 17:29:25 UTC 2013 
Responsible-Changed-Why:  
Can we get this MFC'd to stable/9 and then close this PR?  Submitter says that 
svn R234233 fixes this pr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157770 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/157770: commit references a PR
Date: Sun, 14 Apr 2013 22:38:44 +0000 (UTC)

 Author: jpaetzel
 Date: Sun Apr 14 22:38:28 2013
 New Revision: 249490
 URL: http://svnweb.freebsd.org/changeset/base/249490
 
 Log:
   MFC 234223:
   
   Update to version 2.3.1.0
   
   MFC 234284, 234425, 234481:
   
   Unbreak the build caused by 234233
   
   PR:	kern/157770
   Obtained from:	Daniel Braniss <danny@cs.huji.ac.il>
 
 Modified:
   stable/9/sbin/iscontrol/Makefile
   stable/9/sbin/iscontrol/iscontrol.8
   stable/9/sbin/iscontrol/iscontrol.c
   stable/9/sbin/iscontrol/iscsi.conf.5
   stable/9/sys/dev/iscsi/initiator/isc_subr.c
   stable/9/sys/dev/iscsi/initiator/iscsi.c
   stable/9/sys/dev/iscsi/initiator/iscsi_subr.c
   stable/9/sys/dev/iscsi/initiator/iscsivar.h
 Directory Properties:
   stable/9/sbin/iscontrol/   (props changed)
   stable/9/sys/   (props changed)
   stable/9/sys/dev/   (props changed)
   stable/9/sys/modules/   (props changed)
 
 Modified: stable/9/sbin/iscontrol/Makefile
 ==============================================================================
 --- stable/9/sbin/iscontrol/Makefile	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sbin/iscontrol/Makefile	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -7,8 +7,7 @@ LDADD= -lcam -lmd
  S= ${.CURDIR}/../../sys
  
  WARNS?=	3
 -CFLAGS += -I$S
 -#CFLAGS += -g -DDEBUG
 +CFLAGS+=	-I$S
  
  MAN= iscsi.conf.5 iscontrol.8
  
 
 Modified: stable/9/sbin/iscontrol/iscontrol.8
 ==============================================================================
 --- stable/9/sbin/iscontrol/iscontrol.8	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sbin/iscontrol/iscontrol.8	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
 -.Dd February 22, 2007
 +.Dd August 9, 2010
  .Dt ISCONTROL 8
  .Os
  .Sh NAME
 
 Modified: stable/9/sbin/iscontrol/iscontrol.c
 ==============================================================================
 --- stable/9/sbin/iscontrol/iscontrol.c	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sbin/iscontrol/iscontrol.c	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -44,18 +44,22 @@ __FBSDID("$FreeBSD$");
  #include <arpa/inet.h>
  #include <sys/ioctl.h>
  #include <netdb.h>
 -#include <stdlib.h>
 -#include <unistd.h>
 -#include <stdio.h>
 -#include <string.h>
 +#include <err.h>
  #include <errno.h>
  #include <fcntl.h>
 +#include <libgen.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>
  #include <time.h>
 +#include <unistd.h>
  #include <camlib.h>
  
  #include <dev/iscsi/initiator/iscsi.h>
  #include "iscontrol.h"
  
 +static char version[] = "2.3.1"; // keep in sync with iscsi_initiator
 +
  #define USAGE "[-v] [-d] [-c config] [-n name] [-t target] [-p pidfile]"
  #define OPTIONS	"vdc:t:n:p:"
  
 @@ -109,6 +113,13 @@ isc_opt_t opvals = {
       .immediateData		= TRUE,
  };
  
 +static void
 +usage(const char *pname)
 +{
 +	fprintf(stderr, "usage: %s " USAGE "\n", pname);
 +	exit(1);
 +}
 +
  int
  lookup(token_t *tbl, char *m)
  {
 @@ -124,20 +135,40 @@ int
  main(int cc, char **vv)
  {
       int	ch, disco;
 -     char	*pname, *pidfile, *p, *q, *ta, *kw;
 +     char	*pname, *pidfile, *p, *q, *ta, *kw, *v;
       isc_opt_t	*op;
       FILE	*fd;
 +     size_t	n;
  
       op = &opvals;
       iscsidev = "/dev/"ISCSIDEV;
       fd = NULL;
       pname = vv[0];
 -     if((p = strrchr(pname, '/')) != NULL)
 -	  pname = p + 1;
 +     if ((pname = basename(pname)) == NULL)
 +	  err(1, "basename");
  
       kw = ta = 0;
       disco = 0;
       pidfile = NULL;
 +     /*
 +      | check for driver & controller version match
 +      */
 +     n = 0;
 +#define VERSION_OID_S	"net.iscsi_initiator.driver_version"
 +     if (sysctlbyname(VERSION_OID_S, 0, &n, 0, 0) != 0) {
 +	  if (errno == ENOENT)
 +		errx(1, "sysctlbyname(\"" VERSION_OID_S "\") "
 +			"failed; is the iscsi driver loaded?");
 +	  err(1, "sysctlbyname(\"" VERSION_OID_S "\")");
 +     }
 +     v = malloc(n+1);
 +     if (v == NULL)
 +	  err(1, "malloc");
 +     if (sysctlbyname(VERSION_OID_S, v, &n, 0, 0) != 0)
 +	  err(1, "sysctlbyname");
 +
 +     if (strncmp(version, v, 3) != 0)
 +	  errx(1, "versions mismatch");
  
       while((ch = getopt(cc, vv, OPTIONS)) != -1) {
  	  switch(ch) {
 @@ -146,10 +177,8 @@ main(int cc, char **vv)
  	       break;
  	  case 'c':
  	       fd = fopen(optarg, "r");
 -	       if(fd == NULL) {
 -		    perror(optarg);
 -		    exit(1);
 -	       }
 +	       if (fd == NULL)
 +		    err(1, "fopen(\"%s\")", optarg);
  	       break;
  	  case 'd':
  	       disco = 1;
 @@ -164,9 +193,7 @@ main(int cc, char **vv)
  	       pidfile = optarg;
  	       break;
  	  default:
 -	  badu:
 -	       fprintf(stderr, "Usage: %s %s\n", pname, USAGE);
 -	       exit(1);
 +	       usage(pname);
  	  }
       }
       if(fd == NULL)
 @@ -187,8 +214,8 @@ main(int cc, char **vv)
  	  op->targetAddress = ta;
  
       if(op->targetAddress == NULL) {
 -	  fprintf(stderr, "No target!\n");
 -	  goto badu;
 +	  warnx("no target specified!");
 +	  usage(pname);
       }
       q = op->targetAddress;
       if(*q == '[' && (q = strchr(q, ']')) != NULL) {
 @@ -206,7 +233,7 @@ main(int cc, char **vv)
  	  op->targetPortalGroupTag = atoi(p);
       }
       if(op->initiatorName == 0) {
 -	  char	hostname[256];
 +	  char	hostname[MAXHOSTNAMELEN];
  
  	  if(op->iqn) {
  	       if(gethostname(hostname, sizeof(hostname)) == 0)
 
 Modified: stable/9/sbin/iscontrol/iscsi.conf.5
 ==============================================================================
 --- stable/9/sbin/iscontrol/iscsi.conf.5	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sbin/iscontrol/iscsi.conf.5	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
 -.Dd February 25, 2012
 +.Dd June 5, 2007
  .Dt ISCSI.CONF 5
  .Os
  .Sh NAME
 
 Modified: stable/9/sys/dev/iscsi/initiator/isc_subr.c
 ==============================================================================
 --- stable/9/sys/dev/iscsi/initiator/isc_subr.c	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sys/dev/iscsi/initiator/isc_subr.c	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -1,5 +1,5 @@
  /*-
 - * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
 + * Copyright (c) 2005-2011 Daniel Braniss <danny@cs.huji.ac.il>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
 @@ -77,6 +77,104 @@ i_strdupin(char *s, size_t maxlen)
  
       return q;
  }
 +#if __FreeBSD_version < 800000
 +/*****************************************************************/
 +/*                                                               */
 +/* CRC LOOKUP TABLE                                              */
 +/* ================                                              */
 +/* The following CRC lookup table was generated automagically    */
 +/* by the Rocksoft^tm Model CRC Algorithm Table Generation       */
 +/* Program V1.0 using the following model parameters:            */
 +/*                                                               */
 +/*    Width   : 4 bytes.                                         */
 +/*    Poly    : 0x1EDC6F41L                                      */
 +/*    Reverse : TRUE.                                            */
 +/*                                                               */
 +/* For more information on the Rocksoft^tm Model CRC Algorithm,  */
 +/* see the document titled "A Painless Guide to CRC Error        */
 +/* Detection Algorithms" by Ross Williams                        */
 +/* (ross@guest.adelaide.edu.au.). This document is likely to be  */
 +/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft".        */
 +/*                                                               */
 +/*****************************************************************/
 +
 +static uint32_t crc32Table[256] = {
 +    0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L,
 +    0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL,
 +    0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL,
 +    0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L,
 +    0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL,
 +    0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L,
 +    0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L,
 +    0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL,
 +    0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL,
 +    0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L,
 +    0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L,
 +    0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL,
 +    0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L,
 +    0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL,
 +    0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL,
 +    0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L,
 +    0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L,
 +    0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L,
 +    0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L,
 +    0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L,
 +    0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L,
 +    0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L,
 +    0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L,
 +    0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L,
 +    0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L,
 +    0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L,
 +    0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L,
 +    0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L,
 +    0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L,
 +    0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L,
 +    0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L,
 +    0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L,
 +    0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL,
 +    0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L,
 +    0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L,
 +    0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL,
 +    0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L,
 +    0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL,
 +    0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL,
 +    0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L,
 +    0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L,
 +    0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL,
 +    0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL,
 +    0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L,
 +    0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL,
 +    0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L,
 +    0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L,
 +    0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL,
 +    0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L,
 +    0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL,
 +    0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL,
 +    0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L,
 +    0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL,
 +    0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L,
 +    0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L,
 +    0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL,
 +    0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL,
 +    0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L,
 +    0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L,
 +    0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL,
 +    0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L,
 +    0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL,
 +    0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL,
 +    0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L
 +};
 +
 +static __inline int
 +calculate_crc32c(uint32_t crc, const void *buf, size_t size)
 +{
 +     const uint8_t *p = buf;
 +
 +     while (size--)
 +	  crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
 +     return crc;
 +}
 +#endif
  
  static uint32_t
  i_crc32c(const void *buf, size_t size, uint32_t crc)
 
 Modified: stable/9/sys/dev/iscsi/initiator/iscsi.c
 ==============================================================================
 --- stable/9/sys/dev/iscsi/initiator/iscsi.c	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sys/dev/iscsi/initiator/iscsi.c	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -1,5 +1,5 @@
  /*-
 - * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
 + * Copyright (c) 2005-2011 Daniel Braniss <danny@cs.huji.ac.il>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
 @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
  
  #include <dev/iscsi/initiator/iscsi.h>
  #include <dev/iscsi/initiator/iscsivar.h>
 -static char *iscsi_driver_version = "2.2.4.2";
 +static char *iscsi_driver_version = "2.3.1";
  
  static struct isc_softc *isc;
  
 @@ -231,8 +231,8 @@ iscsi_ioctl(struct cdev *dev, u_long cmd
  	  if(error == 0) {
  	       sp->proc = td->td_proc;
  	       SYSCTL_ADD_INT(&sp->clist, SYSCTL_CHILDREN(sp->oid),
 -		   OID_AUTO, "pid", CTLFLAG_RD,
 -		   &sp->proc->p_pid, sizeof(pid_t), "control process id");
 +			       OID_AUTO, "pid", CTLFLAG_RD,
 +			       &sp->proc->p_pid, sizeof(pid_t), "control process id");
  	  }
  	  break;
  
 @@ -290,8 +290,7 @@ iscsi_read(struct cdev *dev, struct uio 
  	       sprintf(buf, "%03d] '%s' '%s'\n", i++, sp->opt.targetAddress, sp->opt.targetName);
  	       uiomove(buf, strlen(buf), uio);
  	  }
 -	  sprintf(buf, "%d/%d /---- free -----/\n", sc->npdu_alloc, sc->npdu_max);
 -	  i = 0;
 +	  sprintf(buf, "free npdu_alloc=%d, npdu_max=%d\n", sc->npdu_alloc, sc->npdu_max);
  	  uiomove(buf, strlen(buf), uio);
       }
       else {
 @@ -696,7 +695,6 @@ iscsi_shutdown(void *v)
  static void
  free_pdus(struct isc_softc *sc)
  {
 -
       debug_called(8);
  
       if(sc->pdu_zone != NULL) {
 @@ -777,6 +775,10 @@ iscsi_start(void)
  		    sizeof(isc->nsess),
  		    "number of active session");
  
 +#ifdef ISCSI_INITIATOR_DEBUG
 +     mtx_init(&iscsi_dbg_mtx, "iscsi_dbg", NULL, MTX_DEF);
 +#endif
 +
       printf("iscsi: version %s\n", iscsi_driver_version);
  }
  
 @@ -814,6 +816,11 @@ iscsi_stop(void)
  	  xdebug("sysctl_ctx_free failed");
  
       iscsi_shutdown(isc); // XXX: check EVENTHANDLER_ ...
 +
 +#ifdef ISCSI_INITIATOR_DEBUG
 +     mtx_destroy(&iscsi_dbg_mtx);
 +#endif
 +
       free(isc, M_ISCSI);
  }
  
 
 Modified: stable/9/sys/dev/iscsi/initiator/iscsi_subr.c
 ==============================================================================
 --- stable/9/sys/dev/iscsi/initiator/iscsi_subr.c	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sys/dev/iscsi/initiator/iscsi_subr.c	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -154,7 +154,7 @@ getSenseData(u_int status, union ccb *cc
       scsi_rsp_t		*cmd = &pp->ipdu.scsi_rsp;
       caddr_t		bp;
       int		sense_len, mustfree = 0;
 -     int		error_code, sense_key, asc, ascq;
 +     int                error_code, sense_key, asc, ascq;
  
       bp = mtod(pq->mp, caddr_t);
       if((sense_len = scsi_2btoul(bp)) == 0)
 @@ -176,9 +176,8 @@ getSenseData(u_int status, union ccb *cc
       scsi->sense_resid = 0;
       if(cmd->flag & (BIT(1)|BIT(2)))
  	  scsi->sense_resid = ntohl(pp->ipdu.scsi_rsp.rcnt);
 -
       scsi_extract_sense_len(sense, scsi->sense_len - scsi->sense_resid,
 -	&error_code, &sense_key, &asc, &ascq, /*show_errors*/ 1);
 +       &error_code, &sense_key, &asc, &ascq, /*show_errors*/ 1);
  
       debug(3, "sense_len=%d rcnt=%d sense_resid=%d dsl=%d error_code=%x flags=%x",
  	   sense_len,
 @@ -479,6 +478,8 @@ scsi_encap(struct cam_sim *sim, union cc
       cmd = &pq->pdu.ipdu.scsi_req;
       cmd->opcode = ISCSI_SCSI_CMD;
       cmd->F = 1;
 +#if 0
 +// this breaks at least Isilon's iscsi target.
       /*
        | map tag option, default is UNTAGGED
        */
 @@ -488,6 +489,9 @@ scsi_encap(struct cam_sim *sim, union cc
       case MSG_ORDERED_Q_TAG:	cmd->attr = iSCSI_TASK_ORDER;	break;
       case MSG_ACA_TASK:		cmd->attr = iSCSI_TASK_ACA;	break;
       }
 +#else
 +     cmd->attr = iSCSI_TASK_SIMPLE;
 +#endif
  
       dwl(sp, ccb_h->target_lun, (u_char *)&cmd->lun);
  
 
 Modified: stable/9/sys/dev/iscsi/initiator/iscsivar.h
 ==============================================================================
 --- stable/9/sys/dev/iscsi/initiator/iscsivar.h	Sun Apr 14 21:11:19 2013	(r249489)
 +++ stable/9/sys/dev/iscsi/initiator/iscsivar.h	Sun Apr 14 22:38:28 2013	(r249490)
 @@ -1,5 +1,5 @@
  /*-
 - * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
 + * Copyright (c) 2005-2011 Daniel Braniss <danny@cs.huji.ac.il>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
 @@ -204,6 +204,8 @@ struct isc_softc {
       struct sx 		unit_sx;
  
       uma_zone_t		pdu_zone;	// pool of free pdu's
 +     TAILQ_HEAD(,pduq)	freepdu;
 +
  #ifdef  ISCSI_INITIATOR_DEBUG
       int		 npdu_alloc, npdu_max; // for instrumentation
  #endif
 @@ -306,9 +308,11 @@ pdu_alloc(struct isc_softc *isc, int wai
  	  return NULL;
       }
  #ifdef ISCSI_INITIATOR_DEBUG
 +     mtx_lock(&iscsi_dbg_mtx);
       isc->npdu_alloc++;
       if(isc->npdu_alloc > isc->npdu_max)
  	  isc->npdu_max = isc->npdu_alloc;
 +     mtx_unlock(&iscsi_dbg_mtx);
  #endif
       memset(pq, 0, sizeof(pduq_t));
  
 @@ -324,10 +328,12 @@ pdu_free(struct isc_softc *isc, pduq_t *
       if(pq->buf != NULL)
  	  free(pq->buf, M_ISCSIBUF);
  #endif
 +     uma_zfree(isc->pdu_zone, pq);
  #ifdef ISCSI_INITIATOR_DEBUG
 +     mtx_lock(&iscsi_dbg_mtx);
       isc->npdu_alloc--;
 +     mtx_unlock(&iscsi_dbg_mtx);
  #endif
 -     uma_zfree(isc->pdu_zone, pq);
  }
  
  static __inline void
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: jpaetzel 
State-Changed-When: Sun Apr 14 22:54:03 UTC 2013 
State-Changed-Why:  
Initiator code from HEAD merged to 9. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157770 
>Unformatted:
