From owner-freebsd-scsi Mon Mar 6 19:32:29 2000 Delivered-To: freebsd-scsi@freebsd.org Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by hub.freebsd.org (Postfix) with ESMTP id 5FEF437BCF0; Mon, 6 Mar 2000 19:32:24 -0800 (PST) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.9.3/8.9.1) id UAA80344; Mon, 6 Mar 2000 20:32:18 -0700 (MST) (envelope-from ken) Date: Mon, 6 Mar 2000 20:32:18 -0700 From: "Kenneth D. Merry" To: Nick Hibma Cc: Mike Smith , mjacob@feral.com, FreeBSD SCSI Mailing List Subject: Re: first INQUIRY goes round in circles (fwd) Message-ID: <20000306203217.A80256@panzer.kdm.org> References: <20000306143551.A78310@panzer.kdm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from n_hibma@calcaphon.com on Tue, Mar 07, 2000 at 01:42:02AM +0000 Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Mar 07, 2000 at 01:42:02 +0000, Nick Hibma wrote: > After having another look at what CAM does, the following strikes me as > odd. In the case of SF_RETRY_UA being set, the command is retried > _without_ decrementing the retry_count. Can anyone enlighten me as to > why that is being done this way? > > It's the cause of the infinite retry of the initial INQUIRY command. A unit attenion is not supposed to be returned in response to an inquiry. But your drive is returning a unit attention error. Here's the relevant section from the SCSI-2 spec: ======================================================================== The INQUIRY command shall return CHECK CONDITION status only when the target cannot return the requested INQUIRY data. NOTE 64 The INQUIRY data should be returned even though the peripheral device may not be ready for other commands. If an INQUIRY command is received from an initiator with a pending unit attention condition (i.e. before the target reports CHECK CONDITION status), the target shall perform the INQUIRY command and shall not clear the unit attention condition (see 7.9). ======================================================================== So there are two components: - the target should *only* return an error if it cannot return the inquiry data. - any unit attention condition should not be cleared by an inquiry [*] But any other command should generate the check condition which would then clear the unit attention state. So in most cases, a unit attention will be cleared after the first command, so the "infinite" number of retries only ends up being 1. You're running into this problem because you've got a broken driver that reports an error in response to an inquiry. [*] Unit attention handling is actually a little more complicated than I've described, due to contingent allegiance conditions. Don't ask me to explain that, since I don't have a good understanding of it. :) It's explained in the SCSI specs. > (This does not solve the problem of UA not being reset for my drive, > but that needs a quirk anyway, instead of modifying the asc_text quirk > table) You can't have a quirk entry for a device that doesn't have inquiry data yet, since quirk entries are matched against inquiry data. The only way to quirk it would be to have a system specific bus/target/lun quirked. Ken -- Kenneth Merry ken@kdm.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message