** Description changed:

  [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-extra-virtual
  $ sudo nano /etc/fstab
-   LABEL=cloudimg-rootfs   /        ext4   usrquota,grpquota        0 0
+   LABEL=cloudimg-rootfs   /        ext4   usrquota,grpquota        0 0
  $ sudo mount -o remount /
  $ sudo cat /proc/mounts | grep ' / '
-   /dev/sda1 / ext4 rw,relatime,quota,usrquota,grpquota,data=ordered 0 0
+   /dev/sda1 / ext4 rw,relatime,quota,usrquota,grpquota,data=ordered 0 0
  
  # 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
+   /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
+   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
+   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
+   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
+   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
+   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/conf.d/10-mail.conf
- $ sudo sed -i 's/  #mail_plugins = /  mail_plugins = quota /' 
/etc/dovecot/conf.d/20-imap.conf
- $ sudo sed -i 's/  #quota = fs:User quota/  quota = fs:User quota' 
/etc/dovecot/conf.d/90-quota.conf
+ $ sudo sed -i 's/  #mail_plugins = /  mail_plugins = quota imap_quota #/' 
/etc/dovecot/conf.d/20-imap.conf
+ $ sudo sed -i 's/  #quota = fs:User quota/  quota = fs:User quota/' 
/etc/dovecot/conf.d/90-quota.conf
  $ sudo service dovecot restart
  $ doveadm quota get -u ubuntu
-   Quota name Type    Value  Limit   %
-   User quota STORAGE 53248 204800  26
+   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.
+   * 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.2-1-ubuntu4.1
  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
+  * Prerequisite: user quota configured on filesystem where dovecot
  stores your email (e.g. /home partition)
  
-  * configure dovecot fs quota plugin.
+  * 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
+  * 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=ORDEREDSUBJECT 
MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS 
LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN 
CONTEXT=SEARCH LIST-STATUS BINARY MOVE QUOTA] Logged in
  ? 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
                          Block limits                File limits
  User            used    soft    hard  grace    used  soft  hard  grace
  ----------------------------------------------------------------------
  user      -- 2710396 4096001 4194304          65743     0     0

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1795919

Title:
  [SRU] fs quota calculation is wrong

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dovecot/+bug/1795919/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to