https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=57696

--- Comment #14 from Rick Macklem <rmack...@freebsd.org> ---
Still a problem and will affect NFSv4 as well.
The short version is that NFS is not a POSIX compliant file
system.
The only way to reliably read a directory and remove its contents
is to repeatedly read the first entry in the directory (cookie offset 0)
and unlink() that entry until the directory is empty.
(If you modify bonnie++ to do this, it will work correctly over NFS.)
For other cases like rename, there is no fix.

What I believe other clients do to work around the problem is have
opendir() read the entire directory and then the readdir()s return
entries from that and never do getdirentries(2). This gives you
the entire directory in the form it had before the remove/rename...
(I have posted suggesting doing this for FreeBSD, but I've never had
 the collective say "yes, you should do this", so I haven't done it.)
It's actually pretty easy to do, since the code in libc already does
this for for "union" mounts, so changing to do this for NFS mounts
would be easy to code.
The problem with doing this is the libc opendir() is going to use a
lot of address space for large directories and might break in the extreme
case.
I suggested an upper limit on directory size for the above but, again,
since no one said this was a good idea, I didn't pursue it.
(Sorry, it has been a while and I don't remember which email list
 I posted the "should I do this?" to.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to