Subject: yet another opinion sought....
To: None <tech-kern@NetBSD.ORG>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 07/13/1998 13:02:29
[ I like to check with folks on stuff- lots of good opinions out there,
sorry if this seems too chatty ]

I was fixing kern/3835 when I ran into a real annoying problem....
well several problems (like no way to do deferred restarts in
target drivers, no way to do complete error recovery (if you
don't do all your corrective commands in xx_interpret_sense,
you don't get any more chances as by the time xxdone is called
you've lost the opportunity to *not* have biodone called...)), but
this last one is *really* annoying.....


The basic gist of this problem is if a disk gets powered off or
stopped somehow while you have it opened. There are two
flavors of errors you generally get- one is ASC/ASCQ 0x04/0x01,
("Logical Unit Not Ready, Initializataion in Progress"), and the
other is ASC/ASCQ 0x04/0x02 ("Logical Unit Not Ready, Initialization
Command Required"). The former has to be handled with a
delay(N seconds) and a return with ERESTART. The latter has to be
handled with a scsipi_start(....SCSI_POLL|SCSI_NOSLEEP...) and
then a return with ERESTART.

All well and good, right?

Brzzt! No! Wrong! ERESTART is -1, which the @!*$&!*$&!*@$&*!@$
midlayer code interprets as "the device's interpret_sense
didn't do anything- proceed with generic error recovery"- which
is just the wrong thing to do here.

So- should I add in the FreeBSD style SCSIRET_DO_RETRY and
SCSIRET_DO_CONTINUE return codes so that RETRY becomes
an option for target drivers to control?