[Dovecot] Multiple quota roots with quota-fs backend

Ralf Becker beckerr at fh-trier.de
Tue Jul 8 19:15:48 EEST 2008


Hello Stewart,

> You have to previously know or have determined:
>     a) what FS's are under quota

That's easy in my case, because each filesystem is listed in dovecot.conf:

quota  = fs:"Spool":mount=/var/spool/mail
quota2 = fs:"Home0":mount=/home/f0
quota3 = fs:"Home1":mount=/home/f1
quota4 = fs:"Home2":mount=/home/f2
quota5 = fs:"Home3":mount=/home/f3
...

> AND
>     b) know which ones the user uses

That should be easy to, because they are listed in mail_location. In my 
case this is:
   mail_location = mbox:~/Mail:INBOX=/var/spool/mail/%n

> AND
>     c) then make multiple calls, one for each FS that the user has stuff in
> 

Let take 'quota_transaction_set_limits' as example:

If I understand Timo's source code correctly this is done by looping 
through the mountpoints of all quota roots. But then, and this is a 
problem, the lowest quota limit is used, because it is not checked, if 
the mbox file acctually _resides_ in this filesystem.

Well... I think what this behavior could be "fixed" in the same way I've 
used for GETQUOTAROOT:

I've just implemented a callback function 'root_match_box' that returns 
'true', if a Mailbox resides on the filesystem defined "mount=" in quota 
definition and 'false' if not. This optional function is used in 
'quota_root_iter_next' to filter the list of all quota roots.

 From the source code:
----------------------8<----------------------------------------------
  roots = array_get(&iter->quota->roots, &count);
  if (iter->i >= count)
    return NULL;

  for (; iter->i < count; iter->i++) {

    if (roots[iter->i]->backend.v.root_match_box != NULL) {

      if (!roots[iter->i]->backend.v.root_match_box(roots[iter->i],
              iter->box))
        continue;
    }
    ...
  }
---------------------->8----------------------------------------------

The same should be correct in
	quota_transaction_set_limits,
	quota_transaction_commit and
	quota_default_test_alloc

But I should have a deeper look at this... :-)

BTW: If this behavior is indeed AIX specific, that's no problem, In this 
case the function should always returning 'true' or just not be included 
in the list of callback functions.

Regards, Ralf


-- 
______________________________________________________________________

  Dipl.-Inform. (FH) Ralf Becker     Rechenzentrum (r/ft) der FH Trier
  (Network|Mail|Web|Firewall)           University of applied sciences
  Administrator                           Schneidershof, D-54293 Trier

  Mail:   beckerr at fh-trier.de                    Fon: +49 651 8103 499
  WWW:    http://www.fh-trier.de/~beckerr        Fax: +49 651 8103 214
______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6087 bytes
Desc: S/MIME Cryptographic Signature
Url : http://dovecot.org/pipermail/dovecot/attachments/20080708/4d12181a/attachment-0001.bin 


More information about the dovecot mailing list