From owner-freebsd-scsi@FreeBSD.ORG Thu Feb 19 06:52:18 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 2364216A4CE for ; Thu, 19 Feb 2004 06:52:18 -0800 (PST) Received: from msgbas2x.cos.agilent.com (msgbas1tx.cos.agilent.com [192.25.240.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD4B043D1F for ; Thu, 19 Feb 2004 06:52:17 -0800 (PST) (envelope-from chuck_tuffli@agilent.com) Received: from relcos2.cos.agilent.com (relcos2.cos.agilent.com [130.29.152.237]) by msgbas2x.cos.agilent.com (Postfix) with ESMTP id 71B617D4F; Thu, 19 Feb 2004 07:52:17 -0700 (MST) Received: from rtl.rose.agilent.com (rtl.rose.agilent.com [130.30.179.189]) by relcos2.cos.agilent.com (Postfix) with ESMTP id 2861533; Thu, 19 Feb 2004 07:52:17 -0700 (MST) Received: from cre85086tuf.rose.agilent.com (cre85086tuf [130.30.174.150]) ESMTP id GAA12795; Thu, 19 Feb 2004 06:52:15 -0800 (PST) Received: by cre85086tuf.rose.agilent.com (Postfix, from userid 1001) id 54B3719E2AC; Thu, 19 Feb 2004 06:52:02 -0800 (PST) Date: Thu, 19 Feb 2004 06:52:02 -0800 From: Chuck Tuffli To: jerry_ch_lee@wistron.com.tw Message-ID: <20040219145201.GB88769@cre85086tuf.rose.agilent.com> References: <48256E3F.00071B1E.00@TWTPEDS1.WISTRON.COM.TW> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48256E3F.00071B1E.00@TWTPEDS1.WISTRON.COM.TW> User-Agent: Mutt/1.4i cc: freebsd-scsi@freebsd.org Subject: Re: scsi_target crashed when initiator is using LSI PCI-X Ultra320 SC SI 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 14:52:18 -0000 I've been meaning to post a patch, but haven't gotten to it yet. The setup I tested with was similar (WinXP initiator and targ(4)). It appears that Windows sends a REPORT LUNS command which scsi_target doesn't support. In turn, the unsupported command causes scsi_target to abort. Here is a partial patch of the changes I made (this is against 4.9). Note that the CVS logs for scsi_target make some reference to a fix for REPORT LUNS, but I haven't looked into it at all. ---chuck --- ../st_49/scsi_cmds.c Tue Feb 18 14:07:10 2003 +++ scsi_cmds.c Tue Jan 20 12:40:31 2004 @@ -143,11 +143,14 @@ } if (last_cmd->cmd == ILLEGAL_CDB) { if (event != ATIO_WORK) { - warnx("no done func for %#x???", a_descr->cdb[0]); - abort(); + warnx("cdb %#x not handled (evt=%d)", a_descr->cdb[0], + event); + free_ccb((union ccb *)ctio); + return (1); } /* Not found, return illegal request */ - warnx("cdb %#x not handled", a_descr->cdb[0]); + if (debug) + warnx("cdb %#x not handled (evt=%d)", a_descr->cdb[0], event); tcmd_illegal_req(atio, ctio); send_ccb((union ccb *)ctio, /*priority*/1); return (0); @@ -245,12 +248,11 @@ /* Fill out the supplied CTIO */ if (ctio != NULL) { - /* No autosense yet bcopy(sense, &ctio->sense_data, sizeof(*sense)); - ctio->sense_len = sizeof(*sense); XXX - */ + ctio->sense_len = sizeof(*sense); + ctio->ccb_h.flags &= ~CAM_DIR_MASK; - ctio->ccb_h.flags |= CAM_DIR_NONE | /* CAM_SEND_SENSE | */ + ctio->ccb_h.flags |= CAM_DIR_NONE | CAM_SEND_SENSE | CAM_SEND_STATUS; ctio->dxfer_len = 0; ctio->scsi_status = SCSI_STATUS_CHECK_COND; @@ -313,6 +315,10 @@ } else { bcopy(&inq_data, ctio->data_ptr, sizeof(inq_data)); ctio->dxfer_len = inq_data.additional_length + 4; + + /* calculate the residual */ + ctio->resid = ctio->dxfer_len - SCSI_CDB6_LEN(inq->length); + ctio->dxfer_len = min(ctio->dxfer_len, On Wed, Feb 18, 2004 at 08:17:43PM -0500, jerry_ch_lee@wistron.com.tw wrote: > > > > Hi: > > Did anyone have such experience? > My setup is: > > 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) > > Any idea? > > Best regards, > > Jerry Lee > Senior Engineer > Broadband & Storage > Wistron Corp. > (TEL) 886-2-86911521 > (CELL) 886-920894353 > (EMAIL) jerry_ch_lee@wistron.com.tw > (MSN) i_am_jhlee@hotmail.com > > > _______________________________________________ > freebsd-scsi@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" -- Chuck Tuffli Agilent Technologies, Storage Area Networking