From owner-freebsd-scsi@FreeBSD.ORG Mon Feb 25 11:07:11 2008 Return-Path: Delivered-To: freebsd-scsi@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C667A16A494 for ; Mon, 25 Feb 2008 11:07:11 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B34B213C4EA for ; Mon, 25 Feb 2008 11:07:11 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1PB7Bu4033106 for ; Mon, 25 Feb 2008 11:07:11 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1PB7B2r033102 for freebsd-scsi@FreeBSD.org; Mon, 25 Feb 2008 11:07:11 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 25 Feb 2008 11:07:11 GMT Message-Id: <200802251107.m1PB7B2r033102@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-scsi@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-scsi@FreeBSD.org X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2008 11:07:11 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/39388 scsi ncr/sym drivers fail with 53c810 and more than 256MB m o kern/40895 scsi wierd kernel / device driver bug o kern/52638 scsi [panic] SCSI U320 on SMP server won't run faster than s kern/57398 scsi [mly] Current fails to install on mly(4) based RAID di o kern/60598 scsi wire down of scsi devices conflicts with config o kern/60641 scsi [sym] Sporadic SCSI bus resets with 53C810 under load s kern/61165 scsi [panic] kernel page fault after calling cam_send_ccb o kern/74627 scsi [ahc] [hang] Adaptec 2940U2W Can't boot 5.3 o kern/81887 scsi [aac] Adaptec SCSI 2130S aac0: GetDeviceProbeInfo comm o kern/90282 scsi [sym] SCSI bus resets cause loss of ch device o kern/92798 scsi [ahc] SCSI problem with timeouts o kern/94838 scsi Kernel panic while mounting SD card with lock switch o o kern/99954 scsi [ahc] reading from DVD failes on 6.x (regression) o kern/110847 scsi [ahd] Tyan U320 onboard problem with more than 3 disks o kern/120247 scsi [mpt] FreeBSD 6.3 and LSI Logic 1030 = only 3.300MB/s 15 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/35234 scsi World access to /dev/pass? (for scanner) requires acce o kern/38828 scsi [dpt] [request] DPT PM2012B/90 doesn't work o kern/44587 scsi dev/dpt/dpt.h is missing defines required for DPT_HAND o kern/76178 scsi [ahd] Problem with ahd and large SCSI Raid system o kern/114597 scsi [sym] System hangs at SCSI bus reset with dual HBAs o kern/119668 scsi [cam] [patch] certain errors are too verbose comparing o kern/120487 scsi [sg] scsi_sg incompatible with scanners 7 problems total. From owner-freebsd-scsi@FreeBSD.ORG Tue Feb 26 13:09:25 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13B361065670 for ; Tue, 26 Feb 2008 13:09:25 +0000 (UTC) (envelope-from thomas.rasmussen@ventelo.dk) Received: from smtp.webpartner.dk (smtp.webpartner.dk [195.184.96.12]) by mx1.freebsd.org (Postfix) with ESMTP id B8EB713C461 for ; Tue, 26 Feb 2008 13:09:24 +0000 (UTC) (envelope-from thomas.rasmussen@ventelo.dk) Received: from wp-ex02.hq.webpartner.dk (fw.int.webpartner.dk [213.150.34.98]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by smtp.webpartner.dk (Postfix) with ESMTP id DB592938539 for ; Tue, 26 Feb 2008 13:38:25 +0100 (CET) Received: from wp-ex02.hq.webpartner.dk ([10.32.62.19]) by wp-ex02.hq.webpartner.dk ([10.32.62.19]) with mapi; Tue, 26 Feb 2008 13:37:15 +0100 From: Thomas Steen Rasmussen To: "freebsd-scsi@freebsd.org" Date: Tue, 26 Feb 2008 13:37:09 +0100 Thread-Topic: iscsi initiator speed very low in FreeBSD 7 Thread-Index: Ach4dE2fETxsEAjAT9WQngob4rmdCQ== Message-ID: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> Accept-Language: da-DK, en-US Content-Language: da-DK X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: da-DK, en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 13:09:25 -0000 Gentlemen, I am experiencing some serious speed problems with the FreeBSD 7 iscsi init= iator. Introduction: We have recently purchased a SAN (EqualLogic PS5000E, I'll just refer to th= is as "SAN") to use for logfiles among other things. The SAN is accessible = through the iscsi protocol only. Windows Vista / Windows Server 2008 get impressive speeds from this SAN (20= 08 got close to 800 megabits in one test). FreeBSD is not even close to tha= t speed. I have tried a bunch of different things, but I always seem to end= up with a speed close to 700 kilobits. This is all on gigabit links. Test setup: The server (an IBM i386 blade server, EM nics, I'll call this one "blade1")= that needs to access the SAN is a production server. I have therefore configured a test-server (also some i386 blade machine, I'= ll call this one "blade2") for the sole purpose of troubleshooting this iss= ue. I do not have the resources to purchase a test SAN :), so a laptop with isc= si-target will have to do (I'll call this one "laptop-target"). The test initiator "blade2" is running FreeBSD 7.0-PRERELEASE from last wee= k, basic install with no additional stuff installed to screw it up. Iscsi-i= nitiator configured with the most basic configuration, just an target IP an= d target name. The "laptop-target" is configured with PC-BSD 1.4.1 (~FreeBSD 6.3-PRERELASE= ) and the iscsi-target port. I've been told that the iscsi-target port isn'= t built for performance, and I am keeping that in mind. Also, since it is a= laptop, the disk is unable to deliver significant amounts of data. But I b= elieve this test still remains valid. For the test there is a crossover cable between "blade2" and "laptop-target= ", they are both configured with private static IP addresses and the connec= tivity between them is fine. Iperf got to around 690 megabits in a quick te= st. A real world test with SCP also achieved OK speed. I mount the iscsi-ta= rget and try to copy something to the iscsi mounted directory. It works but= the speed is still around 700 kilobits. To make sure this isn't a problem where my test "laptop-target" is unable t= o deliver enough data for some reason, I tried mounting the same target fro= m Windows Vista, formatted it and tested the speed, it got to around 130 me= gabit which I believe is around the max limit for the poor 5400 rpm laptop = drive. So no problems with the laptop, no problems with iscsi-target. The p= roblem really seems to be with the FreeBSD iscsi initiator. I've reproduced this same result again and again and I fail to see any comm= on points between the two separate cases where I have the problem. My netwo= rk or the SAN certainly can't be blamed after seeing the results of this te= st, using a crossover cable and alternate iscsi target. After mailing a bit with Danny Braniss I learned that he got his initiator = to deliver in excess of 80 megabytes/sec when the target is a dedicated app= liance, and 50 megabytes/sec when the target is the iscsi-target port. Nice= to hear that the initiator code is solid enough to deliver speeds like tha= t, but why on earth doesn't it work for me ? dmesg, configs etc. will be forwarded immediately upon request if necessary= :) Thank you in advance! Med venlig hilsen/Kind regards Thomas Rasmussen Sikkerheds- og Unix-Administrator Ventelo Direkte: + 45 35 25 47 46| Mobil: + 45 27 80 80 90 Tlf.: + 45 70 26 23 00 | Fax: + 45 70 26 23 01 =C5rhusgade 88, 2100 K=F8benhavn =D8 thomas.rasmussen@ventelo.dk | www.ventelo.dk From owner-freebsd-scsi@FreeBSD.ORG Tue Feb 26 15:58:17 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19E911065675 for ; Tue, 26 Feb 2008 15:58:17 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from smtp2.enst.fr (revol2.enst.fr [IPv6:2001:660:330f:2::e]) by mx1.freebsd.org (Postfix) with ESMTP id 94EA013C45B for ; Tue, 26 Feb 2008 15:58:16 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from localhost (localhost.enst.fr [127.0.0.1]) by smtp2.enst.fr (Postfix) with ESMTP id DFF61B824A; Tue, 26 Feb 2008 16:58:14 +0100 (CET) X-Virus-Scanned: amavisd-new at enst.fr Received: from bofh.enst.fr (bofh.enst.fr [137.194.32.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by smtp2.enst.fr (Postfix) with ESMTP id 7ED61B8242; Tue, 26 Feb 2008 16:58:14 +0100 (CET) Received: from bofh.enst.fr (localhost [127.0.0.1]) by bofh.enst.fr (8.14.2/8.14.2) with ESMTP id m1QFwE6G078904; Tue, 26 Feb 2008 16:58:14 +0100 (CET) (envelope-from beyssac@bofh.enst.fr) Received: (from beyssac@localhost) by bofh.enst.fr (8.14.2/8.14.2/Submit) id m1QFwDx8078903; Tue, 26 Feb 2008 16:58:13 +0100 (CET) (envelope-from beyssac) Date: Tue, 26 Feb 2008 16:58:13 +0100 From: Pierre Beyssac To: Thomas Steen Rasmussen Message-ID: <20080226155813.GD75747@bofh.enst.fr> References: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="SkvwRMAIpAhPCcCJ" Content-Disposition: inline In-Reply-To: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> User-Agent: Mutt/1.4.2.3i X-message-flag: Warning! Use of Microsoft Outlook makes your system susceptible to worms and viruses X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "freebsd-scsi@freebsd.org" Subject: Re: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 15:58:17 -0000 --SkvwRMAIpAhPCcCJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, On Tue, Feb 26, 2008 at 01:37:09PM +0100, Thomas Steen Rasmussen wrote: > Windows Vista / Windows Server 2008 get impressive speeds from this SAN (2008 got close to 800 megabits in one test). FreeBSD is not even close to that speed. I have tried a bunch of different things, but I always seem to end up with a speed close to 700 kilobits. This is all on gigabit links. I've seen a similar problem (30-second timeout in the code due to a race condition). You might want to try the attached patch. It fixed the slowness for me. I intend to commit it to current very soon. -- A: Yes. Pierre Beyssac pb@enst.fr >Q: Are you sure? >>A: Because it reverses the logical flow of conversation. >>>Q: Why is top posting annoying in email? --SkvwRMAIpAhPCcCJ-- From owner-freebsd-scsi@FreeBSD.ORG Tue Feb 26 16:05:35 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5752B1065672 for ; Tue, 26 Feb 2008 16:05:35 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from smtp2.enst.fr (revol1.enst.fr [IPv6:2001:660:330f:2::7]) by mx1.freebsd.org (Postfix) with ESMTP id D3D8F13C458 for ; Tue, 26 Feb 2008 16:05:34 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from localhost (localhost.enst.fr [127.0.0.1]) by smtp2.enst.fr (Postfix) with ESMTP id 529888444F; Tue, 26 Feb 2008 17:05:33 +0100 (CET) X-Virus-Scanned: amavisd-new at enst.fr Received: from bofh.enst.fr (bofh.enst.fr [137.194.32.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by smtp2.enst.fr (Postfix) with ESMTP id 0380384429; Tue, 26 Feb 2008 17:05:27 +0100 (CET) Received: from bofh.enst.fr (localhost [127.0.0.1]) by bofh.enst.fr (8.14.2/8.14.2) with ESMTP id m1QG5RvI079134; Tue, 26 Feb 2008 17:05:27 +0100 (CET) (envelope-from beyssac@bofh.enst.fr) Received: (from beyssac@localhost) by bofh.enst.fr (8.14.2/8.14.2/Submit) id m1QG5Rd3079132; Tue, 26 Feb 2008 17:05:27 +0100 (CET) (envelope-from beyssac) Date: Tue, 26 Feb 2008 17:05:27 +0100 From: Pierre Beyssac To: Thomas Steen Rasmussen Message-ID: <20080226160527.GE75747@bofh.enst.fr> References: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> <20080226155813.GD75747@bofh.enst.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qGV0fN9tzfkG3CxV" Content-Disposition: inline In-Reply-To: <20080226155813.GD75747@bofh.enst.fr> User-Agent: Mutt/1.4.2.3i X-message-flag: Warning! Use of Microsoft Outlook makes your system susceptible to worms and viruses X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "freebsd-scsi@freebsd.org" Subject: Re: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 16:05:35 -0000 --qGV0fN9tzfkG3CxV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 26, 2008 at 04:58:13PM +0100, Pierre Beyssac wrote: > I've seen a similar problem (30-second timeout in the code due to > a race condition). You might want to try the attached patch. It > fixed the slowness for me. I intend to commit it to current very > soon. Better with the patch... :-) -- A: Yes. Pierre Beyssac pb@enst.fr >Q: Are you sure? >>A: Because it reverses the logical flow of conversation. >>>Q: Why is top posting annoying in email? --qGV0fN9tzfkG3CxV-- From owner-freebsd-scsi@FreeBSD.ORG Wed Feb 27 12:45:07 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C09B61065672 for ; Wed, 27 Feb 2008 12:45:07 +0000 (UTC) (envelope-from freebsd-scsi@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9139F8FC15 for ; Wed, 27 Feb 2008 12:45:07 +0000 (UTC) (envelope-from freebsd-scsi@m.gmane.org) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1JULeg-0007Yn-Ux for freebsd-scsi@freebsd.org; Wed, 27 Feb 2008 12:45:02 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2008 12:45:02 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2008 12:45:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-scsi@freebsd.org From: Ivan Voras Date: Wed, 27 Feb 2008 13:45:35 +0100 Lines: 32 Message-ID: References: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> <20080226155813.GD75747@bofh.enst.fr> <20080226160527.GE75747@bofh.enst.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig4BA330B087A507BB7E2D8765" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.6 (X11/20071022) In-Reply-To: <20080226160527.GE75747@bofh.enst.fr> X-Enigmail-Version: 0.95.0 Sender: news Subject: Re: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 12:45:07 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig4BA330B087A507BB7E2D8765 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Pierre Beyssac wrote: > On Tue, Feb 26, 2008 at 04:58:13PM +0100, Pierre Beyssac wrote: >> I've seen a similar problem (30-second timeout in the code due to >> a race condition). You might want to try the attached patch. It >> fixed the slowness for me. I intend to commit it to current very >> soon. >=20 > Better with the patch... :-) I think you need to send a file with a .txt extension for it to pass the spam / list filters. --------------enig4BA330B087A507BB7E2D8765 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHxVtvldnAQVacBcgRAurQAKCaNqfVxwK8FWgoWZp1I+9LPg1EpgCgiPQ6 FSEfMdHK1W56xW6aB3Fypck= =jhqS -----END PGP SIGNATURE----- --------------enig4BA330B087A507BB7E2D8765-- From owner-freebsd-scsi@FreeBSD.ORG Wed Feb 27 13:11:09 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9E81065670; Wed, 27 Feb 2008 13:11:09 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from smtp2.enst.fr (revol2.enst.fr [137.194.2.14]) by mx1.freebsd.org (Postfix) with ESMTP id 895AF8FC25; Wed, 27 Feb 2008 13:11:09 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from localhost (localhost.enst.fr [127.0.0.1]) by smtp2.enst.fr (Postfix) with ESMTP id 3B999B8253; Wed, 27 Feb 2008 13:50:34 +0100 (CET) X-Virus-Scanned: amavisd-new at enst.fr Received: from bofh.enst.fr (bofh.enst.fr [137.194.32.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by smtp2.enst.fr (Postfix) with ESMTP id E030FB81B0; Wed, 27 Feb 2008 13:50:33 +0100 (CET) Received: from bofh.enst.fr (localhost [127.0.0.1]) by bofh.enst.fr (8.14.2/8.14.2) with ESMTP id m1RCoXb2035981; Wed, 27 Feb 2008 13:50:33 +0100 (CET) (envelope-from beyssac@bofh.enst.fr) Received: (from beyssac@localhost) by bofh.enst.fr (8.14.2/8.14.2/Submit) id m1RCoX5I035980; Wed, 27 Feb 2008 13:50:33 +0100 (CET) (envelope-from beyssac) Date: Wed, 27 Feb 2008 13:50:33 +0100 From: Pierre Beyssac To: Ivan Voras Message-ID: <20080227125033.GA35933@bofh.enst.fr> References: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> <20080226155813.GD75747@bofh.enst.fr> <20080226160527.GE75747@bofh.enst.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-message-flag: Warning! Use of Microsoft Outlook makes your system susceptible to worms and viruses Cc: freebsd-scsi@freebsd.org Subject: Re: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 13:11:09 -0000 On Wed, Feb 27, 2008 at 01:45:35PM +0100, Ivan Voras wrote: > > Better with the patch... :-) > I think you need to send a file with a .txt extension for it to pass the > spam / list filters. Here it is inline... --- isc_sm.c 2007-07-24 17:35:02.000000000 +0200 +++ /tmp/isc_sm.c 2008-02-26 16:53:54.000000000 +0100 @@ -325,7 +325,9 @@ mtx_unlock(&sp->io_mtx); // XXX } #else + mtx_lock(&sp->io_mtx); // XXX wakeup(&sp->flags); + mtx_unlock(&sp->io_mtx); // XXX #endif return error; } @@ -454,6 +456,11 @@ } } +/* + * Should be called with sp->io_mtx held to avoid race condition + * on queue empty. + * Returns with sp->io_mtx held. + */ static int proc_out(isc_session_t *sp) { @@ -481,6 +488,8 @@ if((pq = i_dqueue_snd(sp, which)) == NULL) break; + mtx_unlock(&sp->io_mtx); + pp = &pq->pdu; bhs = &pp->ipdu.bhs; switch(bhs->opcode) { @@ -523,6 +532,8 @@ xdebug("error=%d ndone=%d opcode=0x%x ccb=%p itt=%x", error, ndone, bhs->opcode, pq->ccb, ntohl(bhs->itt)); if(error == EPIPE) { + pdu_free(sp->isc, pq); + mtx_lock(&sp->io_mtx); // XXX: better do some error recovery ... break; } @@ -540,6 +551,7 @@ } if(pq->ccb == NULL || error) pdu_free(sp->isc, pq); + mtx_lock(&sp->io_mtx); } return ndone; } @@ -558,13 +570,13 @@ sp->flags |= ISC_SM_RUNNING; do { + mtx_lock(&sp->io_mtx); if(sp->flags & ISC_SM_HOLD) odone = 0; else odone = proc_out(sp); sdebug(7, "odone=%d", odone); if(odone == 0) { - mtx_lock(&sp->io_mtx); #ifdef ISC_OWAITING sp->flags |= ISC_OWAITING; #endif @@ -574,8 +586,8 @@ #ifdef ISC_OWAITING sp->flags &= ~ISC_OWAITING; #endif - mtx_unlock(&sp->io_mtx); } + mtx_unlock(&sp->io_mtx); } while(sp->flags & ISC_SM_RUN); sp->flags &= ~ISC_SM_RUNNING; -- A: Yes. Pierre Beyssac pb@enst.fr >Q: Are you sure? >>A: Because it reverses the logical flow of conversation. >>>Q: Why is top posting annoying in email?