[Dovecot] mbox locking
Timo Sirainen
tss at iki.fi
Wed Jun 28 12:47:29 EEST 2006
On Wed, 2006-06-28 at 10:52 +0200, Thomas Hummel wrote:
> > If a mail delivery agent uses only dotlocking, then it means that
> > Dovecot's read locking doesn't work, so Dovecot could see half-written
> > mails at the end of the mbox.
>
> In such a case, does it get corrected on the next mbox read or is it
> too late (the UA as already seen/cached the half written message) ?
Hmm. Actually Dovecot locks the mbox for writing whenever it notices the
mbox has changed, so it shouldn't ever see half-written messages.
Perhaps I shouldn't do that if mbox_lazy_writes is set, since it's not
needed then..
Anyway, if it did only read-lock it and saw a half-written message, at
the next sync it would notice that it changed. But I don't think it
reassigns a new UID for it, so any cached in formation (in
dovecot.index.cache or in client side) wouldn't get updated.
> > > 2. Obviously, fcntl in write_locks should be exclusive, but is the
> > > lock set by fcntl in mbox_read_lock exclusive or shared ?
> >
> > It's shared.
>
> > Writers should do also the fcntl locking. As long as that's done,
> > multiple shared fcntl locks can be acquired so it's then safe to read
> > the mbox.
>
> So you seem to confirm that a read should acutally block a write
Right.
> (note
> : this seem to make sense but I was wondering if some priority to
> writes were not implemented) ?
There's nothing like that. If you want something like that use another
mailbox format.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20060628/e5462e9a/attachment.pgp
More information about the dovecot
mailing list