From owner-freebsd-scsi Sat Apr 21 14:29: 9 2001 Delivered-To: freebsd-scsi@freebsd.org Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (Postfix) with ESMTP id DC3B337B423 for ; Sat, 21 Apr 2001 14:29:03 -0700 (PDT) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.9.3/8.9.3) with UUCP id XAA23300; Sat, 21 Apr 2001 23:29:01 +0200 (CEST) Received: (from j@localhost) by uriah.heep.sax.de (8.11.3/8.11.3) id f3LLRwf02467; Sat, 21 Apr 2001 23:27:58 +0200 (MET DST) (envelope-from j) Date: Sat, 21 Apr 2001 23:27:58 +0200 (MET DST) Message-Id: <200104212127.f3LLRwf02467@uriah.heep.sax.de> Mime-Version: 1.0 X-Newsreader: knews 0.9.8 Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) Organization: Private BSD site, Dresden X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E References: <20010414203925.A63281@uriah.heep.sax.de> <200104150504.f3F544s00932@aslan.scsiguy.com> <20010418225355.U688@uriah.heep.sax.de> From: j@uriah.heep.sax.de (J Wunsch) Subject: Re: Problem with current sa(4) driver X-Original-Newsgroups: local.freebsd.scsi To: freebsd-scsi@freebsd.org Cc: j@uriah.heep.sax.de, mjacob@feral.com Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org J Wunsch wrote: >> While it is true that the sa driver should be filtering out this >> particular case because there is no error, returning ERESTART for >> NO_SENSE is also wrong. You should be able to fix that by changing >> the table entry for that sense code in cam_periph.c. > > You mean, like this? Hmm, no comments? > I tried to manually patch the return value of cam_periph_error() to 0 > in kgdb, but this just gets me back at the second problem: > > % ps axl > UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND > ... > 107 373 1 0 -8 0 244 33 cbwait DWE p0- 0:00.00 dd if=/dev/sa0 of=/dev/null bs=10 > > It sits there, and waits indefinately. OK, i found this one. Obviously, the device queue is still frozen at this point. The following patch fixes the problem for me, by now only tested against that ARCHIVE Python DDS drive, but will also test shortly against my Tandberg TDC4222 drive. What the fix does is filtering out `no errors', i. e. illegal length indications with a shorter tape block than requested, and hitting a filemark during read, and then instead of calling cam_periph_error(), simply making sure that the device queue is really becoming unfrozen at exit (in case of an actual error, cam_periph_error() performs the unfreeze). I'd like to commit the fix to scsi_sa.c (or have Matt commit it, i don't care). Also repeated the patch for cam_periph.c that makes a NO_SENSE return no error, which should IMHO be what Justin was referring to in the quote above. Any feedback highly appreciated, since i feel a little far out on thin ice here in CAM-land. Index: cam_periph.c =================================================================== RCS file: /home/ncvs/src/sys/cam/cam_periph.c,v retrieving revision 1.34 diff -u -r1.34 cam_periph.c --- cam_periph.c 2001/04/04 18:24:35 1.34 +++ cam_periph.c 2001/04/17 17:46:11 @@ -1369,6 +1369,8 @@ switch (err_action & SS_MASK) { case SS_NOP: + error = 0; + break; case SS_RETRY: action_string = "Retrying Command"; error = ERESTART; Index: scsi/scsi_sa.c =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_sa.c,v retrieving revision 1.67 diff -u -r1.67 scsi_sa.c --- scsi/scsi_sa.c 2001/03/27 05:45:12 1.67 +++ scsi/scsi_sa.c 2001/04/21 21:05:53 @@ -2286,7 +2286,7 @@ u_int32_t resid = 0; int32_t info = 0; int error_code, sense_key, asc, ascq; - int error, defer_action; + int error, defer_action, no_actual_error = FALSE; periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct sa_softc *)periph->softc; @@ -2396,6 +2396,8 @@ if (defer_action) { error = -1; softc->flags |= SA_FLAG_EOF_PENDING; + } else { + no_actual_error = TRUE; } /* * Unconditionally, if we detected a filemark on a read, @@ -2424,6 +2426,8 @@ softc->flags |= SA_FLAG_EIO_PENDING; else error = EIO; + } else { + no_actual_error = TRUE; } /* * Bump the block number if we hadn't seen a filemark. @@ -2438,8 +2442,17 @@ } } } - if (error == 0) + if (error == 0 && !no_actual_error) return (cam_periph_error(ccb, cflgs, sflgs, &softc->saved_ccb)); + if (no_actual_error) { + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(ccb->ccb_h.path, + /* relsim_flags */0, + /* openings */0, + /* timeout */0, + /* getcount_only */ FALSE); + return (0); + } if (error == -1) return (0); -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message