Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2003 04:28:41 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        current@freebsd.org
Subject:   Re: "got bad cookie" warnings/errors?
Message-ID:  <3F38CF69.182D4B2@mindspring.com>
References:  <200308100406.47211.coolvibe@hackerheaven.org> <20030810181824.GA14355@walton.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F38CF69.182D4B2>