Post by omega on Jan 30, 2007 18:23:18 GMT 7
Hi,
I've found a bug in the folder quota management.
I'd like to show it by an example:
1) Create a test folder (let's say quotatest) and the set quota to 0.1 GB (yes, in the quota field you can specify floating point values too).
2) Now we check /proc/qtamgn which gives us the actual settings for the quota manager
# cat /proc/qtamgn
QTA 102 0 /raid/data/quotatest
3) Now we create a 100 MB temp file named "foo"
# dd if=/dev/zero of=/raid/data/quotatest/foo bs=1M count=100
4) Check again /proc/qtamgn:
# cat /proc/qtamgn
QTA 102 100 /raid/data/quotatest
5) Create another 100 MB file named "bar"
# dd if=/dev/zero of=/raid/data/quotatest/bar bs=1M count=100
6) Check again /proc/qtamgn:
# cat /proc/qtamgn
QTA 102 200 /raid/data/quotatest
Oops...
We installed a quota of 102 MB and we have written 200 MB without any error! The first number in /proc/qtamgn gives the quota in MB and the second number the actual used space in the directory.
The problem seems to be Thecus is only checking the actual quota before a file is written. The check doesn't take into account the amount data that is written. So no matter how much your quota is, you are always able to write a single 100GB file without getting blocked.
But that's not all.....
Consider that we are just complted step 6) above. Now we just issue again the command from step 5). Now we get an error message that there is not enough space on that device. Fine.
But now the file size of the file "bar" is zero. Maybe fine.
And what does /proc/qtamgn says:
QTA 102 200 /raid/data/quotatest
Now we have a big problem. Starting from now the whole quota calculation is wrong. Because if we delete the file bar with it's new size of 0 bytes that value is subtracted from the quota, so after "rm bar" /proc/qtamgn says:
QTA 102 200 /raid/data/quotatest
But we only have 100 MB because of the file foo.
The same applies if I issue the command "cat > bar" and then press CTRL-D. This command resets a file to zero size. The quota manager isn't able to handle this situation too.
If you screwed up the quota manager, it is simple to reset it though: just disbaled the quota by setting the quota value to zero and enable it again (or better leave it disabled ).
These are only some quick tests I made. I expect that there are even more cases where the quota manager is doing the wrong this.
I think the quota manager in this version is almost useless and might cause troubles. Until it is fixed I wouldn't use it and I cannot recommend it to others.
Andreas
I've found a bug in the folder quota management.
I'd like to show it by an example:
1) Create a test folder (let's say quotatest) and the set quota to 0.1 GB (yes, in the quota field you can specify floating point values too).
2) Now we check /proc/qtamgn which gives us the actual settings for the quota manager
# cat /proc/qtamgn
QTA 102 0 /raid/data/quotatest
3) Now we create a 100 MB temp file named "foo"
# dd if=/dev/zero of=/raid/data/quotatest/foo bs=1M count=100
4) Check again /proc/qtamgn:
# cat /proc/qtamgn
QTA 102 100 /raid/data/quotatest
5) Create another 100 MB file named "bar"
# dd if=/dev/zero of=/raid/data/quotatest/bar bs=1M count=100
6) Check again /proc/qtamgn:
# cat /proc/qtamgn
QTA 102 200 /raid/data/quotatest
Oops...
We installed a quota of 102 MB and we have written 200 MB without any error! The first number in /proc/qtamgn gives the quota in MB and the second number the actual used space in the directory.
The problem seems to be Thecus is only checking the actual quota before a file is written. The check doesn't take into account the amount data that is written. So no matter how much your quota is, you are always able to write a single 100GB file without getting blocked.
But that's not all.....
Consider that we are just complted step 6) above. Now we just issue again the command from step 5). Now we get an error message that there is not enough space on that device. Fine.
But now the file size of the file "bar" is zero. Maybe fine.
And what does /proc/qtamgn says:
QTA 102 200 /raid/data/quotatest
Now we have a big problem. Starting from now the whole quota calculation is wrong. Because if we delete the file bar with it's new size of 0 bytes that value is subtracted from the quota, so after "rm bar" /proc/qtamgn says:
QTA 102 200 /raid/data/quotatest
But we only have 100 MB because of the file foo.
The same applies if I issue the command "cat > bar" and then press CTRL-D. This command resets a file to zero size. The quota manager isn't able to handle this situation too.
If you screwed up the quota manager, it is simple to reset it though: just disbaled the quota by setting the quota value to zero and enable it again (or better leave it disabled ).
These are only some quick tests I made. I expect that there are even more cases where the quota manager is doing the wrong this.
I think the quota manager in this version is almost useless and might cause troubles. Until it is fixed I wouldn't use it and I cannot recommend it to others.
Andreas