On Tue, Oct 07, 2003 at 08:33:25PM -0400, Chris Shenton wrote:
> At work I tested a FreeBSD-4.9-PRERELEASE client against our netapp
> and found the same failure with the "nfstest" program Brian posted. A
> Solaris-2.9 client did not exhibit this problem.
Apparently a "bad cookie" message is logged for each failure event, and the
following related thread has been pointed out to me:
http://lists.freebsd.org/pipermail/freebsd-current/2003-August/008402.html
The implication of what is written there is that readdir() is entitled to
fail if the directory has been changed underneath it.
I don't know how Linux and Solaris cope with this: do they take an in-memory
snapshot of the whole directory at the client side, which readdir() then
traverses? Or do they just blindly continue to traverse a directory which
they know has changed?
Regards,
Brian.

Responsible Changed
From-To: freebsd-bugs->cel
Linux and Solaris watch the mtime of the directory while it's being
read. If the mtime changes, those clients know that the directory
itself has changed, and effectively re-read the directory contents
from the beginning.

FYI, 13 years later, this is still an issue with FreeSD 11.0-RELEASE. If I run bonnie++ from a FreeBSD NFSv3 client to a Synology NAS NFSv3 server, I still see the error.
$ bonnie++ -u murray
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...Bonnie: drastic I/O error (rmdir): Directory not empty
Cleaning up test directory after error.
Is there any chance this works with the NFSv4 client in FreeBSD, or is it still the same codepath?