Bug 34059 - user can write a file exceed the disk space the quota distrute to him
Summary: user can write a file exceed the disk space the quota distrute to him
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: quota (Show other bugs)
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
Target Milestone: ---
Assignee: Preston Brown
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-03-30 13:32 UTC by Bill Huang
Modified: 2005-10-31 22:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-04-06 08:20:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test program:filetest.c (807 bytes, patch)
2001-03-30 13:33 UTC, Bill Huang
no flags Details | Diff

Description Bill Huang 2001-03-30 13:32:09 UTC
test with qa0327.0 tree 

quota given user bill 150k space,it is correct that it is failed to write a
200k size file.
however when the function ftruncate() is used to fill 200k size file,it
returned true and the file was created.

the source of test program is attached.

not too sure it is a quota issue or glibc issue...

[root@dolphins /root]# cat /etc/fstab
LABEL=/                 /                       ext2    defaults        1 1
LABEL=/bhuang            /bhuang                 ext2   
defaults,usrquota   1 2LABEL=/boot             /boot                  
ext2    defaults        1 2
/dev/fd0                /mnt/floppy             auto    noauto,owner    0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/pts                devpts  gid=5,mode=620  0 0
/dev/hda6               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              iso9660
noauto,owner,kudzu,ro 0
[root@dolphins /root]# mount /bhuang
[root@dolphins /root]# tocuh /bhuang/quota.user
bash: tocuh: command not found
[root@dolphins /root]# touch /bhuang/quota.user
[root@dolphins /root]# convertquota /bhuang
[root@dolphins /root]# mount -o remount /bhuang
[root@dolphins /root]# quotacheck -a
[root@dolphins /root]# quotaon -a
[root@dolphins /root]# edquota bill
[root@dolphins /root]# repquota bill
[root@dolphins /root]# edquota bill
[root@dolphins /root]#

[root@station23 bhuang]# cat edquota-bill 
Quotas for user bill:
  Filesystem                  Blocks       Soft       Hard    Inodes     
Soft      Hard
/dev/hda7                        200        100        150        
1         0         0

[bill@dolphins bill]$ ./a.out 
ide0(3,7): warning, user block quota exceeded.
                                              ide0(3,7): write failed, user
block limit reached.
                write error!!
ftruncate result = 0
[bill@dolphins bill]$ 

the result of test program:

ot@dolphins /root]# ll /bhuang
-rw-------    1 root     root          200  37n 30 21:28 1
-rw-------    1 root     root         7168  37n 30 21:34 aquota.user
-rw-------    1 root     root         2048  37n 30 21:30 aquota.user~
drwxr-xr-x    2 root     root        16384  37n 30 19:17 lost+found
-rw-r--r--    1 root     root            0  37n 30 21:30 quota.user
-rw-r--r--    1 bill     bill       204800  37n 30 21:33 testfile
[root@dolphins /root]#

Comment 1 Bill Huang 2001-03-30 13:33:30 UTC
Created attachment 14223 [details]
test program:filetest.c

Comment 2 Jakub Jelinek 2001-04-03 22:26:24 UTC
What ls -l sais is completely uninteresting here, try du -b
instead. Quota is about used blocks on the disk, with holes you can
have several gigabytes large file which occupies only a few kilobytes
on the disk e.g.

Comment 3 Bill Huang 2001-04-06 08:15:26 UTC
result of du -b testfile:
151552  testfile

The behaviour of quota is correct?
and ftruncate() is also correct?

Comment 4 Jakub Jelinek 2001-04-06 08:20:25 UTC
Yes, the behaviour is correct. The file occupies less than 150K on the disk.

Note You need to log in before you can comment on or make changes to this bug.