Re: "got bad cookie" warnings/errors?

From: Terry Lambert <tlambert2_at_mindspring.com>
Date: Tue, 12 Aug 2003 04:28:41 -0700
David Malone wrote:
> On Sat, Aug 09, 2003 at 09:15:45PM -0700, Lars Eggert wrote:
> > I can only say that (1) I've been getting these forever, on both -stable
> > and -current, and (2) I personally have never lost any data.
> >
> > However, I have no clue as to why you and I get them, or what they signify.
> 
> I have a vague feeling they are related to a directory changing while it
> is being read, and might mean that the NFS client sees an inconsistent
> version of the directory. It's been a long time since I looked at it
> though.

This happens when the directory changes on the server out from
under a directory traversal in progress.

The most canonically correct thing to do is deal with this as
a single block restart; the NFS code, though, deals with it by
rereading from the beginning of the directory, rather than the
beginning of the block.

To implement the other way, you'd need to (effectively) get rid
of cookies entirely.  For this to work, you'd need to split the
VOP_READDIR into two parts: one to get a block, and one to take
a block that you got, and externalize it.  Then it could be FS
independent, but on a block boundary for restarting the directory
read back a block, instead of from the start of the file.

In general, this basically means that on really large directories,
locality of reference pretty much dictates that you might get into
a loop where you end up stuck doing this restart indefinitely.

Pretty ugly, actually...

-- Terry
Received on Tue Aug 12 2003 - 02:30:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:18 UTC