Subject: Re: test of new powerdown facility
To: Matthew Jacob <mjacob@feral.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 06/09/1998 13:27:26
[ BTW, Matt... your mailer is CCing things to tech-kern-owner; might make
  sure it's parsing the headers correctly... --thorpej ]

On Tue, 9 Jun 1998 12:19:46 -0700 
 Matthew Jacob <mjacob@feral.com> wrote:

 > Is this the old bdelwrite bug still?

...probably not.  When the file system is unmounted, delayed writes are
not used.  I think what's happening here is that the initiator is being
told that that the operation is done, but the disk hasn't actually put
the bits on the platter.

I think there's sufficient evidence to suggest that this is the case (e.g.
the problem does not occur if you halt the machine but do not remove power;
the kernel is no longer running, but the data eventually makes it to disk).

 > There is such a command (SCSI3)- like any SCSI command, it's no
 > guarantee that all drives implement it correctly.

It's in SCSI-2, as well.  I don't know about SCSI-1.

 > This also depends on the mode settings of the drives as to whether or
 > not the writes are acked prior to being on stable storage. What are
 > the SCSI2 cache page settings for this Quantum Fireball?

>From my reading S. 9.2.18, if Immed is not set, then the target will
not return status until the operation has completed, regardless of any
mode page settings.

So, it looks like the right thing here is to issue a SYNCHRONIZE CACHE
with addr 0/len 0, and ignore ILLEGAL REQUEST (in case the device does
not support the command).  Quoting the spec:

	The number of blocks field specified the total number of
	contiguous logical blocks within the range.  A number of
	blocks of zero indicates that all remaining logical blocks
	on the logical unit shall be within the range.

	A logical block within the specified range that is not in
	cache memory is not considered an error.

...so addr 0/len 0 would be interpreted as "all remaining logical blocks
beginning at address 0".

...and of course, only do this if the device is SCSI-2 or greater (unless
someone can point to pre-SCSI-2 devices that support this operation).

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 428 6939