Re: Retry scsi_mode_sense if UNIT ATTENTION occurs

Alan Stern
2003-07-29T21:10:40Z

On Tue, 29 Jul 2003, Kai Makisara wrote:

> On Mon, 28 Jul 2003, Alan Stern wrote:
>
> > Jens:
> >
> > This patch changes the scsi_mode_sense() routine to retry up to a total of
> > 3 times if a command fails with a UNIT ATTENTION sense key value.
> >
> This is dangerous or makes __scsi_mode_sense usable only in special cases.
> Some high-level drivers need to process the UNIT ATTENTION sense data.

I don't know what you're talking about. __scsi_mode_sense() is called
only from a very few places within sr.c and sd.c, and none of the calling
routines pays any notice to the sense data.

> > Without this change, sr.c does not properly read the capabilities mode
> > page for a just-powered-up cdrom drive -- it gives up upon receiving a
> > Device Reset Occurred code.
> >
> One alternative is to move the retry code upwards to scsi_mode_sense and
> document that it may discard UNIT ATTENTION. Those drivers that can't
> tolerate this can then use __scsi_mode_sense. This would solve the sr
> problem.

But scsi_mode_sense() allocates its own struct scsi_request, whereas the
callers in sd.c already have one available.

I wouldn't object to documenting in both scsi_mode_sense() and
__scsi_mode_sense() that UNIT ATTENTION sense data is discarded.

Alan Stern