linux (but not samba) quotas

MCCALL,DON (HP-USA,ex1) don_mccall at
Wed Mar 28 20:30:31 GMT 2001

Hi Jeremy,
Seems to me that incurring all the disk accesses necessary to actually WRITE
all those zeros would be more performance costly than adding in some
overhead to detect a 'holey' write, and verify appropriate diskspace for the
extended filesize;  if NO (extension would generate a fs full (or quota
exceed) condition), then return the error to that write at that time...

Problems with this approach that pop to mind:
1. what about applications that routinely extend the file a little at a
time, thus incurring more overhead from the fstat or whatever we use to
check the diskspace availability
2. some other process sneaking in and using up the disk space between when
we say the holey write would be ok, and when we actually WRITE the data.

Just a thought,
-----Original Message-----
From: Jeremy Allison [mailto:jeremy at]
Sent: Wednesday, March 28, 2001 10:57 AM
To: David Collier-Brown
Cc: David Lee; Jim McDonough; samba-technical at
Subject: Re: linux (but not samba) quotas

David Collier-Brown wrote:
>         This reproduces the symptom reported: a file is written,
>         sometimes in odd orders, and when closed
>         - appears to be of the desired size, but
>         - actually contains "large blocks of nulls" (i.e., is holey)

Yes, this is a generic difference between Windows semantics
and POSIX that is annoying.

Under POSIX, seeking past the end of a file and doing a one
byte write creates a "holey" file, whose size is reported as
the seek size + 1. Under NT, this actually reserves the data
space needed on disk.

The only way to fix this under Samba POSIX is to force writes of
zero bytes in the intermediate space when extending a file.
That way, out of space errors can be reported at the time NT
expects to see them.

This is something we haven't yet done, but could be added as
an option. I'll look into this.

There are other nasty differences that I doubt Microsoft
has thought much about. For instance, has anyone set up
NT quotas and then used the new code in smbcacls to chown
a file owner to get around quota limits for a user ? :-).

As such a thing isn't possible under the Win32 API's without
having admin privs (although it's perfectly simple over the
network interface) I wonder if they designed their quota
support with this in mind.... :-) :-).


Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.

More information about the samba-technical mailing list