readdir loses renamed files

From: Timo Sirainen
Date: Sun Oct 24 2004 - 20:24:22 EST


I'd have thought this had already been asked many times before, but google didn't show me anything.

My problem is that mails in a large maildir get temporarily lost. This happens because readdir() never returns a file which was just rename()d by another process. Either new or the old name would have been fine, but it's not returned at all.

Is there a chance this could get fixed? Every OS/filesystem I've tested so far has had the same problem, so I'll have to implement some extra locking anyway (so much for maildir being lockless), but it would be nice to have at least one OS where it works without the extra locking overhead.

I have a test program if someone wants to try it: http://dovecot.org/tmp/readdir.c

(and please Cc replies)

Attachment: PGP.sig
Description: This is a digitally signed message part