atapi cdrecord under 5.2

Kenneth D. Merry ken at
Wed Jan 28 15:05:58 PST 2004

[ resend from a different address so my post will go through, sorry for the
duplicate ]

On Wed, Jan 28, 2004 at 11:53:10 +0100, Pav Lucistnik wrote:
> V st, 28. 01. 2004 v 11:07, Harti Brandt p??e:
> > That may be the same problem I discovered yesterday together with Joerg
> > Schilling (the cdrecord author). According to him, for several kinds of CD
> > recorders error returns from the recorder are expected by cdrecord (some
> > recorders, for example, return an error for long writes, although they
> > process it (this is allowed by the SCSI spec)). cdrecord handles these
> > error (and they do not turn up as errors to the user), but in order to do
> > this it expectes the CAM layer to return correct sense data after an error
> > (the CAM spec requires the CAM layer to automatically issue a SENSE
> > command after errors). As you can see in the above output, the sense data
> > is all zero, which seems to be broken. At the moment it's not clear, where
> > the problem exactly is: CAM, ATAPICAM or ATAPI.
> Since ATAng commit sense bytes are no longer automatically filled on
> error conditions. This very regression was worked around in recent
> growisofs (I did the testing for author). If you as kernel developer
> could try looking into it that would be great...

Since ATAPICAM doesn't do autosense itself, the error recovery code has to
issue the request sense command.  (That code was actually somewhat broken
initially, since every other driver requests sense for a failed command.
So ATAPICAM was the first SIM driver not to do it.)

By default, though, commands that are issued through the pass(4) driver
(like the commands from cdrecord) do not go through the error recovery
code.  You have to set the CAM_PASS_ERR_RECOVER flag on the CCB to enable
error recovery.  (And set the retry count appropriately.)

For cdrecord, enabling error recovery in the kernel for its commands is
probably not desirable.  It probably needs to see errors and deal with

So we've got two basic choices:
 - modify cdrecord, and other applications, to look for the
   CAM_AUTOSNS_VALID status flag on a failed CCB and issue the request
   sense command if necessary.
 - modify ATAPICAM to do autosense.

The latter would probably be the easiest for application developers to deal

I assume that you fixed growisofs by using the first method.

Kenneth Merry
ken at FreeBSD.ORG

More information about the freebsd-current mailing list