Inbox quota usage doubled when mailbox_list_index enabled, under some circumstances

Chris Dillon chris.dillon at cpanel.net
Thu Jul 26 18:03:52 EEST 2018


Hello,

I searched through the list archives for anything that appeared to be 
similar to this but I didn't find any good matches.  I apologize if this 
has been brought up before.

Beginning with Dovecot 2.2.34, reported quota usage of a user's inbox 
can be doubled when the following criteria are met:

1) quota plugin is enabled
2) mailbox_list_index=yes
3) A sub-folder of the inbox exists whose name also matches the prefix 
(for example, "INBOX.Test"), even if that folder has no contents.  
(Apparently, some mail clients such as K-9 Mail on Android can create 
these folders automatically)

Downgrading to 2.2.33.2 allows this configuration to work normally. I 
looked through the changes in git between 2.2.33.2 and 2.2.34 and they 
appeared extensive, so unfortunately I wasn't able to pinpoint a 
specific change that caused this.

Reproduced on a CentOS 7 server with Dovecot 2.2.34 built from git 
sources according to 
https://wiki2.dovecot.org/CompilingSource#Compiling_Dovecot_From_Git 
using the following minimal configuration:

==========
root at centos7 [~]# dovecot -n
# 2.2.34 (874deae): /usr/local/etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-862.9.1.el7.x86_64 x86_64 CentOS Linux release 
7.5.1804 (Core)
# Hostname: centos7.local
mail_location = maildir:~/Maildir
mail_plugins = quota
mailbox_list_index = yes
namespace inbox {
   inbox = yes
   location =
   prefix = INBOX.
   separator = .
}
passdb {
   driver = pam
}
plugin {
   quota = maildir:Mailbox
}
userdb {
   driver = passwd
}
==========

With the system user "myuser" and a minimal Maildir setup containing 1 
email in the inbox, and one sub-folder named "INBOX.Test":

==========
root at centos7 [~]# ls -lAR /home/myuser/Maildir
/home/myuser/Maildir:
total 4
drwxr-xr-x. 2 myuser myuser 77 Jul 25 09:36 cur
drwxr-xr-x. 5 myuser myuser 56 Jul 25 15:19 .INBOX.Test
-rw-r--r--. 1 myuser myuser 14 Jul 25 15:19 maildirsize
drwxr-xr-x. 2 myuser myuser  6 Jul 25 09:36 new
drwxr-xr-x. 2 myuser myuser  6 Jul 25 09:36 tmp

/home/myuser/Maildir/cur:
total 12416
-rw-r--r--. 1 myuser myuser 12712627 Jul 25 09:07 
1532529376.M543965P58007.centos7.local,S=12712627,W=12877782:2,S

/home/myuser/Maildir/.INBOX.Test:
total 0
drwxr-xr-x. 2 myuser myuser 6 Jul 25 09:36 cur
-rw-r--r--. 1 myuser myuser 0 Jul 25 09:36 maildirfolder
drwxr-xr-x. 2 myuser myuser 6 Jul 25 09:36 new
drwxr-xr-x. 2 myuser myuser 6 Jul 25 09:36 tmp

/home/myuser/Maildir/.INBOX.Test/cur:
total 0

/home/myuser/Maildir/.INBOX.Test/new:
total 0

/home/myuser/Maildir/.INBOX.Test/tmp:
total 0

/home/myuser/Maildir/new:
total 0

/home/myuser/Maildir/tmp:
total 0
==========

Given this configuration, when "mailbox_list_index" is enabled, after 
quota recalculation, quota reports that there are 2 messages and that 
double the amount of storage is used:

==========
root at centos7 [~]# doveadm quota recalc -u myuser; doveadm quota get -u 
myuser
Quota name Type    Value 
Limit                                                   %
Mailbox    STORAGE 24830 
-                                                   0
Mailbox    MESSAGE     2 
-                                                   0
==========

When "mailbox_list_index" is disabled and quota is recalculated, it will 
report the message and storage counts correctly:

==========
root at centos7 [~]# doveadm -o 'mailbox_list_index=no' quota recalc -u 
myuser; doveadm quota get -u myuser
Quota name Type    Value 
Limit                                                   %
Mailbox    STORAGE 12415 
-                                                   0
Mailbox    MESSAGE     1 
-                                                   0
==========

I am hoping that someone with much more familiarity with the code path 
involved here could take a look at this issue and possibly submit a fix 
for it -- that would be greatly appreciated.  Please let me know if you 
need any more details regarding the replication steps, though I hope 
that I didn't miss anything.

Thank you!

-- 

Chris Dillon
Technical Analyst III
Migrations Specialist
cPanel, Inc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3998 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://dovecot.org/pipermail/dovecot/attachments/20180726/e44f2235/attachment.p7s>


More information about the dovecot mailing list