[Dovecot] INBOX stored in AFS

Hans-Werner Paulsen hans at MPA-Garching.MPG.DE
Thu Oct 30 12:14:41 EET 2008


On Mon, Oct 20, 2008 at 06:56:55PM +0300, Timo Sirainen wrote:
> On Mon, 2008-10-20 at 16:16 +0200, Hans-Werner Paulsen wrote:
> > When I start my imap-client, I see the content of the INBOX, and I can
> > read, delete, ... the different entries. But when new mail arrives dovecot
> > (and my imap-client) will never notice this. And when I quit my imap-client
> > the dovecot imap server will write back its view of the INBOX, and delete
> > this new mail.
> > This seems to be a problem related to AFS. I poked in the dovecot code and
> > have the following theory: dovecot opens the INBOX R/W, dovecot calls "stat"
> > on the INBOX file periodically to look for modifications. But this does
> > not work, because this machine will stat the local copy (AFS cache) of the
> > INBOX as long as this file is still open R/W.
> 
> I'd have thought that the local view was updated at least after fcntl
> locking the mailbox.
> 
> > My questions:
> > Is it possible to have a configuration, that the INBOX file is not left open
> > when stat-ing this file?
> > Or is it possible to open the INBOX file R/W only when it us locked?
> > Or is it necessary to modify the code?
> 
> It's necessary to modify the code. Probably not difficult (maybe in
> mbox_unlock()), but I'd rather not change that code permanently since
> this is a pretty AFS-specific problem..
> 

I checked flock (fcntl locking is not working at all) semantics on the AFS
filesystem with some small test programs:
Calling flock does NOT update the local view of the AFS file, if it is
opened R/W. But, status information seems to be up-to-date if the file
is opened R/O.
Now I want to modify the dovecot code for mbox processing in the following
way:
open the mbox R/O
before modifying the mbox file: close it, dot-lock the file and open it R/W
after modifying the mbox file: close it, remove the dot-lock, and open it R/O

Any hints in which files I have to look for the necessary modifications?

Thank you for your help,
HW

-- 
Hans-Werner Paulsen		hans at MPA-Garching.MPG.DE
MPI für Astrophysik		Tel 089-30000-2602
Karl-Schwarzschild-Str. 1	Fax 089-30000-2235	
D-85741 Garching


More information about the dovecot mailing list