Heiko Schlittermann writes:

Hello,

the rules about calculating the maildirsize file contain a very last
step: if there was a race condition (maildir changes during the
recalculation), then return the calculated size, but remove remove the
maildirsize file.

Now I'm sitting in front of maildir/maildirquota.c around line 512.
There the tmp maildirsize file gets renamed to maildirsize. Around line 550
the check for the race condition is done. But I do not see, how the
newly created maildirsize file gets deleted.

I'm I stupid or just blind?

The key code path is maildir_quota_add_start(), the code path that modifies the existing quota.

Note that when the aforementioned race condition gets detected, recalculation_needed is set to 1, and errno is set to EAGAIN.

Note the outer loop in maildir_quota_add_start() that invokes maildir_checkquota again if errno is EAGAIN. Up to five times. If the race condition gets hit five times in a row, we just throw our hands up, and give up.

On the next call to maildir_checkquota, because recalculation_needed is 1, we attempt to add everything up again, which writes out a new maildirsize file, and deletes the existing one.

The maildirsize file does not actually get deleted. It cannot be physically deleted, because it defines the maildir's quota. Rather, it gets forcibly recalculated, and a new one gets written out and renamed again.




Attachment: pgpvJ4PovMzdb.pgp
Description: PGP signature

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to