Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2001 16:28:12 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        =?iso-8859-1?Q?G=E9rard_Roudier?= <groudier@free.fr>
Cc:        Thomas Quinot <thomas@cuivre.fr.eu.org>, stable@FreeBSD.ORG, scsi@FreeBSD.ORG
Subject:   Re: Failure to attach SCSI CD burner
Message-ID:  <20010828162812.A31937@panzer.kdm.org>
In-Reply-To: <20010828212323.J1476-100000@gerard>; from groudier@free.fr on Tue, Aug 28, 2001 at 10:00:11PM %2B0200
References:  <20010827135440.A21092@panzer.kdm.org> <20010828212323.J1476-100000@gerard>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 28, 2001 at 22:00:11 +0200, Gérard Roudier wrote:
> On Mon, 27 Aug 2001, Kenneth D. Merry wrote:
> > On Mon, Aug 27, 2001 at 21:35:28 +0200, Gérard Roudier wrote:
> > > On Sun, 26 Aug 2001, Kenneth D. Merry wrote:
> > > > On Mon, Aug 27, 2001 at 01:09:14 +0200, Thomas Quinot wrote:
> > > > > Le 2001-08-26, Kenneth D. Merry écrivait :
> > > > >
> > > > > > Hmm.  Well, try applying the attached patch to sys/cam/scsi/scsi_cd.c and
> > > > > > recompile your kernel.
> > > > >
> > > > > OK, some new info:
> > > > >
> > > > > 1. with NO CD in the drive, I did not actually get the failure reported
> > > > >    before, but only the following messages:
> > > > >
> > > > > cd0 at sym0 bus 0 target 2 lun 0
> > > > > cd0: <IMS CDD2000/00 1.26> Removable CD-ROM SCSI-2 device
> > > > > cd0: 3.300MB/s transfers
> > > > > cd0: Attempt to query device size failed: NOT READY, Logical unit not ready, cause not reportable
> > > > >
> > > > > (and then subsequently cd0 was correctly attached and usable)
> > > >
> > > > That's normal.
> > > >
> > > > > 2. with a DEFECTIVE CD-R in the drive (that had been sitting in there
> > > > >    for some time I guess...) I reproduced the failure:
> > > > >
> > > > > (cd0:sym0:0:2:0): autosense is NOT valid
> > > > > (cd0:sym0:0:2:0): flags = 0x40 status = 0x4c
> > > > > (cd0:sym0:0:2:0): got CAM status 0x4c
> > > > > (cd0:sym0:0:2:0): fatal error, failed to attach to device
> > > > > (cd0:sym0:0:2:0): lost device
> > > > > (cd0:sym0:0:2:0): removing device entry
> > > > >
> > > > > and then retrying the command with camcontrol yields /valid/
> > > > > sense data.
> > > >
> > > > Hmm, okay.  So the drive was not empty before when you were having
> > > > failures?  It looks like, at least the first time through, the autosense
> > > > valid flag isn't getting set for the read capacity command.
> > > >
> > > > Gerard, do you have any ideas as to why the autosense valid bit might not
> > > > be getting set the first time we send a read capacity to his drive?
> > > > (Apparantly with a certain bad CD-R in the drive.)
> > >
> > > I could better understand the situation if I got the previous postings on
> > > this topic. Btw, I didn't retrieve in what place the first 2 messages are
> > > printed from the code. May-be they are just printed out by your patch (?).
> >
> > They're on the -scsi list, I figured you were still on the list.
> >
> > See:
> >
> > http://docs.freebsd.org/mail/archive/2001/freebsd-scsi/20010826.freebsd-scsi.html
> > http://docs.freebsd.org/mail/current/freebsd-scsi.html
> >
> > Yes, the first two lines are printed out by a patch I gave Thomas.  (To
> > figure out why the cd(4) driver was not attaching.  It will attach,
> > regardless of the SCSI sense sent back, unless the sense information is
> > "logical unit not supported".  When there is no sense, though, there's no
> > way to figure out what's going on.)
> >
> > > If I understand your statement, the SIM is reported a CHECK CONDITION SCSI
> > > status from the device, but does not assert the CAM_AUTOSNS_VALID flag. Is
> > > my guessing correct?
> >
> > Yes, that is what it looks like is happening.  Apparantly it only happens
> > the first time we send a read capacity to the drive.  (On probe.)
> > Subsequent read capacity commands via camcontrol return CCBs with valid
> > sense data and the CAM_AUTOSNS_VALID flag set.
> 
> I double-checked the sym driver source and didn't find any code path
> explaining such behaviour. I mean, the driver returning SCSI_STATUS_ERROR
> on either CHECK CONDITION or TERMINATED STATUS. If an error occurs during
> auto-sense, the driver should either return some severe cam status value,
> or indicate that sense data are not valid in the cam status.

Well, it looks like it's doing just that -- returning
CAM_SCSI_STATUS_ERROR, but without the CAM_AUTOSNS_VALID flag set.

> It would have been fine to also display out the actual value of the scsi
> status returned by the device. Being 100% sure is far better than only
> 99%. :)
> Let me suggest Thomas to add such a trace to scsi_cd.c and to give another
> try with his CD burner.

The patch I gave him does this -- the status is 0x4c, which is
CAM_SCSI_STATUS_ERROR | CAM_DEV_QFRZN.  (See above.)

> This 1% of chance for another SCSI status to have been returned gives the
> following scenario some chance to happen. :)
> 
> The read capacity is performed with 1 retry max by the cd driver.
> 
> 1) The device returns SCSI_STATUS_BUSY.
> 2) 1 second later the retry is performed.
> 3) The device still returns SCSI_STATUS_BUSY.
> 4) cam_periph_errof() return EIO.
> 5) then the problem reported by Thomas does happen.
> 
> I may be wrong, obviously. Sorry if I am.

You've got a point, it may well be returning busy instead of check
condition.  I'll send him another patch to check for that.

Ken
-- 
Kenneth Merry
ken@kdm.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010828162812.A31937>