preallocated file size

Nicolas Williams Nicolas.Williams at
Mon Feb 7 16:56:16 GMT 2000

On Mon, 7 Feb 100, jeremy at wrote:
> > 
> > There is still another bug in Samba. When writing a file to share that
> > is larger than the free space on the disk the file is allocated with 
> > its full length. During the copy process you'll get an error, but the
> > file will be left on the samba-share and it will be reported with it's
> > original size. A full report can be read at 
> > The same happens when quotas are 
> > used. I send this problem to this list some weeks ago, but it seams to
> > unimportant to the mass. 
> It's not unimportant, it's just unclear how to 
> fix it ! The client is expliticly setting the file 
> size, then one of the writes into the file is failing 
> (probably with ENOSPC). Now what should Samba do here ? 

The problem is that on Unix systems seeking a file descriptor position
over file space that's not been allocated and writing any data at that
point causes "holey" files.

Obviously this must not be the case in the Windows world.

Thus, the most complete fix for this problem, IMNSHO, would be to write
the implicit nulls when a client asks Samba to do so. This approach
would result in pre-allocation of all the blocks necessary and would
fail before completing if the file system in question fills up before
the operation can be completed. This will result in just the behaviour
the clients expect.

> The client *explicitly* told us what file size to set. 
> Do we then override that and deliberately truncate the 
> file on write fail ? Should we do this ? Opinions 
> please. 

See above.

> Thanks, 
>         Jeremy Allison, 
>         Samba Team. 

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the samba-technical mailing list