[bug report] disk quota exceed after multiple write/delete loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On the latest kernel 6.0.0-0.rc2, I find the user quota limit in an
ext4 mount is unstable, that after several successful "write file then
delete" loops, it will finally fail with "Disk quota exceeded". This
bug can be reproduced on at least kernel-6.0.0-0.rc2 and
kernel-5.14.0-*, but can't be reproduced on kernel-4.18.0 based RHEL8
kernel.

Reproducer (can also be found as the attachment):
```
#!/bin/bash

# setup
groupadd -f quota_test
useradd -g quota_test quota_test_user1
dd if=/dev/null of=ext4_5G.img bs=1G seek=5
lo_dev=$(losetup -f --show ext4_5G.img)
mkdir /mntpt
mkfs.ext4 -F ext4_5G.img
mount -o usrquota ext4_5G.img /mntpt
chmod 777 /mntpt
quotacheck -u /mntpt
setquota -u quota_test_user1 200000 300000 2000 3000 /mntpt
quotaon -u /mntpt

# test
for i in $(seq 1 100); do
    echo "*** Run#$((i++)) ***"
    echo "--- Quota before writing file ---"; quota -uv
quota_test_user1; echo "--- ---"
    su - quota_test_user1 -c "dd if=/dev/zero of=/mntpt/test_300m
bs=1024 count=300000" || break_flag=1
    echo "--- Quota after writing file ---"; quota -uv
quota_test_user1; echo "--- ---"
    rm -f /mntpt/test_300m
    sleep 10s # in case slow deletion
    echo "--- Quota after deleting file ---"; quota -uv
quota_test_user1; echo "--- ---"
    [[ $break_flag -eq 1 ]] && break
done

# cleanup
umount /mntpt
losetup -D
rm -rf ext4_5G.img /mntpt
userdel -r quota_test_user1
groupdel quota_test
```

Run log on kernel-6.0.0-0.rc2
```
(...skip successful Run#[1-2]...)
*** Run#3 ***
--- Quota before writing file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0       0  200000  300000               0    2000    3000
--- ---
dd: error writing '/mntpt/test_300m': Disk quota exceeded
299997+0 records in
299996+0 records out
307195904 bytes (307 MB, 293 MiB) copied, 1.44836 s, 212 MB/s
--- Quota after writing file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0  300000* 200000  300000   7days       1    2000    3000
--- ---
--- Quota after deleting file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0       0  200000  300000               0    2000    3000
--- ---
```

The kernel in test can be found at
https://koji.fedoraproject.org/koji/buildinfo?buildID=2050107

Attachment: test_quota_v01.sh
Description: Bourne shell script


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux