zfs set userquota behaving strangely

Status
Not open for further replies.

chris.shelton

Dabbler
Joined
Jun 9, 2015
Messages
36
Hi all,

I have tried setting a userquota for my users which is working, but not quite as expected.

I set a quota on myself with the command:

zfs set userquota@chris=10M pool/data

When I run zfs userspace pool/data I can see that the quota has taken effect.

But for some reason, it lets me transfer files large than 10MB across. I transferred a 40MB file across just fine, and the userspace shows used: 39.2M and quota: 10M. Now, if I go and try transfer something else across like a 3MB file, that fails due to not enough space, so it seems the quota is working in a way.

Also, if I transfer a 387MB file across, it will get part way through and then run out of space, saying that 274MB more space is needed, but why was it able to get down to 274 when the limit is 10?

Am I misunderstanding the way zfs quotas work?

Thanks, Chris.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Try eliminating using a protocol for better test case. But you have a great question I don't know the answer to and will be waiting to find out.
 
D

dlavigne

Guest
According to zfs(8):

Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the EDQUOT error message. See the userspace subcommand for more information.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
According to zfs(8):

Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the EDQUOT error message. See the userspace subcommand for more information.

That right there is the answer. It takes time from when you copy a file for Samba to process it, then hand it over to zfs, then the transaction to be written and closed. Until the transaction is complete there is no way to know how much or little data is copied. FreeNAS defaults to 5 second intervals assuming you don't hit other needs for a transaction to close first. So in a best-case scenario they can copy about 5 seconds worth of throughput more than their quota will allow.
 
Status
Not open for further replies.
Top