On Sat, 2007-11-10 at 19:51 -0500, Adam McDougall wrote:
On Sun, Nov 11, 2007 at 02:34:33AM +0200, Timo Sirainen wrote:
I'm beginning to understand the problem. Or at least one of them. :)
Dovecot is currently flushing attribute cache for files it wants to stat/open. But that's not enough. It also has to flush attribute cache for the directory, or it might stat/open a file that has already been unlinked (but which still has links somewhere in the filesystem so that it doesn't fail with ESTALE).
dotlock_use_excl=yes seems to help somewhat with this problem for now. It also gives better performance.
I'm assuming that only helps if I use dotlock locking, right?
No, maildir always uses dotlocks.
This is getting difficult though. After many hours I've finally gotten it to work properly without indexes. But even that required a pretty evil hack. It looks like the only way I can get FreeBSD to flush its filename cache (or whatever it's called that maps filenames to inodes) is to call rmdir() to the directory and hope that it fails with ENOTEMPTY. So this can't be safely done if the directory may be empty, as is easily possible with Maildir/cur and Maildir/new directories..
With indexes enabled it then starts giving errors immediately about transaction logs. I think I'll leave figuring that out for later. I'm guessing the read cache flushing code doesn't work properly either.
I hope Linux supports cache flushes better..