From owner-freebsd-scsi@FreeBSD.ORG Wed Feb 18 21:54:42 2004 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACFC516A4CF for ; Wed, 18 Feb 2004 21:54:42 -0800 (PST) Received: from web21105.mail.yahoo.com (web21105.mail.yahoo.com [216.136.227.107]) by mx1.FreeBSD.org (Postfix) with SMTP id A870843D1F for ; Wed, 18 Feb 2004 21:54:42 -0800 (PST) (envelope-from materribile@yahoo.com) Message-ID: <20040219055442.97978.qmail@web21105.mail.yahoo.com> Received: from [24.228.74.10] by web21105.mail.yahoo.com via HTTP; Wed, 18 Feb 2004 21:54:42 PST Date: Wed, 18 Feb 2004 21:54:42 -0800 (PST) From: Mark Terribile To: jerry_ch_lee@wistron.com.tw, freebsd-scsi@freebsd.org In-Reply-To: <48256E3F.00071B1E.00@TWTPEDS1.WISTRON.COM.TW> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: scsi_target crashed when initiator is using LSI PCI-X Ultra320 SCSI card X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2004 05:54:42 -0000 Jerry, > Initiator: PC with Windows 2000, LSI Ultra320 SCSI card > Target: PC with FreeBSD 5.2, on-board Adaptec 7899W chip > command on target: > ./scsi_target 0:1:0 file > > When I rescan hardware on initiator, the Target's scsi_target program exit > itself. Then I re-run scsi_target program again, and rescan hardware on >initiator, then... > > Target crashed! ( I can't grab the log because it's not logged in messages) My recent work was on a different setup (Linux initiator) but I found that when _anything_ changed (including the SCSI target emulator exiting or dying) I had to rescan on the initiator or else things would crash soon. Try rescanning the initiator after the emulator shuts down, before restarting it. And then you have to debug the target emulator. It took me a while to figure out how the confounded thing works. The key is the queues on which the transaction structs (I don't have it in front of me and do not recall their names, but there is one kind for ATIOs and one for CTIOs) are placed. They start out on one fixed queue, and are placed on another (different for ATIO and CTIO) when the struct is sent to the SCSI target layer via the write(2) on targN. When they are returned with work to do, the CTIOs are placed on queues linked to the ATIOs while the async read or write is underway. Side note in case you haven't been watching VERY closely: /dev/targ0, /dev/targ1, etc., are created WHEN YOU OPEN THEM in FreeBSD5.x; if they exist you can't open them because something else has the file open! Hope this helps. I'm curious about this one; I may have to play target to a MicroSoft initiator one of these days. Seems lots of people are making SCSI targets of themselves these days. Mark Terribile materribile@yahoo.com __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools