Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2001 10:03:02 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Brian Reichert <reichert@numachi.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: got bad cookie vp 0xe2e5ef80 bp 0xcf317328
Message-ID:  <3BB20A46.474E3C48@mindspring.com>
References:  <20010925093643.W49528@numachi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Brian Reichert wrote:
>                         /*
>                          * Yuck! The directory has been modified on the
>                          * server. The only way to get the block is by
>                          * reading from the beginning to get all the
>                          * offset cookies.
>                          *
>                          * Leave the last bp intact unless there is an error.
>                          * Loop back up to the while if the error is another
>                          * NFSERR_BAD_COOKIE (double yuch!).
>                          */

This is technically incorrect.  Unless the directory has been
truncated back, the way to do this is to do a mod on the block
size for the offset given, and assume a compression of the
directory block out from under you.  So you do the mod, and
then that gives you the directory block (compression does not
occur across blocks), and then chain forward in the block until
you have an index that exceeds the cookie index, and then go
back one.  The best way to do that is to remember the index one
previous.

In the case of a truncation, you're done.

The ultimate "bad" result from this will be a duplicate entry
from the iteration of the directory.  Dealing with a duplicate
entry is the job of the NFS client.

Note that a directory iteration is just a "snapshot", much like
"ps", and is not guaranteed to remain accurate, just as taking
a polaroid picture of a crowd will not necessarily remain an
accurate indicator of who is there, since it could change in
the time between when the picture is taken and it develops.

The best way would be to avoid cookies entirely, but FreeBSD is
not structured for this (cookies were introduced in the 4.4-Lite
release by NetBSD, and adopted by everyone else, including the
4.4-Lite2 release; NetBSD and OpenBSD have a different cookie
parameter order than FreeBSD, as well).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BB20A46.474E3C48>