[SRU] fs quota calculation is wrong
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dovecot (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
Dovecot users using the fs quota plugin see wrong quota calculation (incorrect overquota situation).
[Test Case]
On host system:
---------------
$ multipass launch 18.04 --name ubuntu-bionic
$ multipass exec ubuntu-bionic -- bash
In vm:
------
$ sudo passwd ubuntu # set to 'ubuntu'
# Enable quota support on root partition
$ sudo apt-get install linux-image-
$ sudo nano /etc/fstab
LABEL=
$ sudo mount -o remount /
$ sudo cat /proc/mounts | grep ' / '
/dev/sda1 / ext4 rw,relatime,
# Set a quota
$ sudo apt-get install quota
$ sudo quotacheck -ugm /
$ sudo quotaon -v /
/dev/sda1 [/]: group quotas turned on
/dev/sda1 [/]: user quotas turned on
$ sudo edquota -u ubuntu
Disk quotas for user ubuntu (uid 1000):
Filesystem blocks soft hard inodes soft hard
/dev/sda1 36 0 0 12 0 0
# Set these to some arbitrary values:
Filesystem blocks soft hard inodes soft hard
/dev/sda1 36 10 20 12 0 0
$ sudo quota -vs ubuntu
Disk quotas for user ubuntu (uid 1000):
Filesystem space quota limit grace files quota limit grace
/dev/sda1 48K* 10K 20K 7days 14 0 0
$ sudo quota -vs ubuntu
Disk quotas for user ubuntu (uid 1000):
Filesystem space quota limit grace files quota limit grace
/dev/sda1 48K* 10K 20K 7days 14 0 0
$ sudo setquota -u ubuntu 200M 220M 0 0 /
$ sudo quota -v ubuntu
Disk quotas for user ubuntu (uid 1000):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda1 52 204800 225280 15 0 0
# Install dovecot and configure with the quota plugin
$ sudo apt-get install dovecot-core dovecot-imapd
$ sudo sed -i 's/^#mail_plugins = /mail_plugins = quota/' /etc/dovecot/
$ sudo sed -i 's/ #mail_plugins = / mail_plugins = quota imap_quota #/' /etc/dovecot/
$ sudo sed -i 's/ #quota = fs:User quota/ quota = fs:User quota/' /etc/dovecot/
$ sudo service dovecot restart
$ doveadm quota get -u ubuntu
Quota name Type Value Limit %
User quota STORAGE 53248 204800 26
# Connect via imap
$ openssl s_client -connect localhost:993
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot (Ubuntu) ready.
? LOGIN ubuntu ubuntu
? OK [... QUOTA] Logged in
? GETQUOTAROOT INBOX
* QUOTAROOT INBOX "User quota"
* QUOTA "User quota" (STORAGE 53248 204800)
? OK Getquotaroot completed (0.001 + 0.000 secs).
[Regression Potential]
* only users using the fs quota plugin are affected
[Original Report]
Packages:
dovecot 2.2.33.
ubuntu 18.04.1 LTS
The quota is erroneously calculated with the fs quota plugin.
It was working fine on ubuntu 16.04 with the same config.
* Prerequisite: user quota configured on filesystem where dovecot stores your email (e.g. /home partition)
* configure dovecot fs quota plugin.
Quota configuration:
plugin {
quota = fs:User quota
}
* use doveadm command to verify the result:
$doveadm quota get -u user
The result is shown in kb and as a percentage value
Here's the IMAP Session:
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot (Ubuntu) ready.
? LOGIN user password
? OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=
? GETQUOTAROOT INBOX
* QUOTAROOT INBOX "User quota"
* QUOTA "User quota" (STORAGE 2775445504 4096001)
? OK Getquotaroot completed (0.001 + 0.000 secs).
Storage should actually be around 2775445 KB.
The quota is correct from my ext3 filesystem quota of 4096001 KB.
Output of repquota:
*** Report for user quotas on device /dev/sdc
Block grace time: 7days; Inode grace time: 7days
User used soft hard grace used soft hard grace
-------
user -- 2710396 4096001 4194304 65743 0 0
tags: | added: bitesize |
description: | updated |
Changed in dovecot (Ubuntu Bionic): | |
status: | Triaged → Incomplete |
summary: |
- fs quota calculation is wrong + [SRU] fs quota calculation is wrong |
description: | updated |
Thank you for taking the time to report this bug and helping to make Ubuntu better.
Unfortunately I don't see anything I can do about this in Ubuntu right now. Can you reproduce this problem with a build direct from upstream sources (of this version - 2.2.33.2), without packaging? If so, then filing a bug upstream would be appropriate. If it does not, please let us know here with full steps to reproduce on a fresh Ubuntu system and we might be able to figure out if packaging is breaking it somehow.