From owner-freebsd-scsi@FreeBSD.ORG Thu Feb 19 22:41:26 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 F359116A4CE for ; Thu, 19 Feb 2004 22:41:25 -0800 (PST) Received: from twtpems2.wistron.com.tw (twtpems2.wistron.com.tw [210.63.110.32]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D50043D1D for ; Thu, 19 Feb 2004 22:41:25 -0800 (PST) (envelope-from jerry_ch_lee@wistron.com.tw) Received: from TWTPEDS1.WISTRON.COM.TW (unverified [210.63.109.150]) by twtpems2.wistron.com.tw (Content Technologies SMTPRS 4.3.10) with SMTP id ; Fri, 20 Feb 2004 13:55:11 +0800 Received: by TWTPEDS1.WISTRON.COM.TW (Lotus SMTP MTA v4.6.7 (934.1 12-30-1999)) id 48256E40.0020303A; Fri, 20 Feb 2004 13:51:34 +0800 X-Lotus-FromDomain: WISTRON From: jerry_ch_lee@wistron.com.tw To: Chuck Tuffli Message-ID: <48256E40.00202F5A.00@TWTPEDS1.WISTRON.COM.TW> Date: Fri, 20 Feb 2004 13:51:39 +0800 Mime-Version: 1.0 Content-type: text/plain; charset="us-ascii" Content-Disposition: inline cc: freebsd-scsi@freebsd.org Subject: Re: scsi_target crashed when initiator is using LSI PCI-X Ultra320SC 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: Fri, 20 Feb 2004 06:41:26 -0000 Hi Chuck: It works! Great job! Thanks! 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 Chuck Tuffli on 2004/02/19 10:52:02 PM To: Jerry CH Lee/WHQ/Wistron@Wistron cc: freebsd-scsi@freebsd.org Subject: Re: scsi_target crashed when initiator is using LSI PCI-X Ultra320 SC SI card This document is classified as Normal 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