Samba seems to behave incorrectly when writing beyond the current end of file

Richard Sharpe rsharpe at
Tue Sep 21 17:17:42 GMT 2004


A couple of days ago I asked a question about the Windows redirector
behavior when it was holding an exclusive oplock on a file and an
application was writing data (beyond the end of the file).

After further testing, I have seen Win2K use the following strategy
against Samba when writing a 12MB file in 64kB chunks (that is, the
application was writing in 64kB chunks):

1. Open File requesting OpLock, exclusive was granted.
2. Write 1 byte at offset 1114111
3. Query file standard info for EOF
4. Write 1 byte at offset 1114111+64kB
5. Query file standard info for EOF
6. Write 1 byte at offset 1114111+64kB+64kB

Now, it seems to me that Windows is using those 1 byte writes to provoke
EXQUOTA and ENOSPC errors so they can be accurately reflected to the
application. However, this is not going to work under default UNIX because
it will write holes, and will probably only allocate one 4kB block per 1
byte write.

It would seem that if the customer cares about getting correct errors when
EXQUOTA occurs (because the current behavior results in
STATUS_UNSUCCESSFUL being returned when the file is closed, but the
redirector does not know what to do with that), we might need some way to
specify that we want all blocks written/

Richard Sharpe, rsharpe[at], rsharpe[at],

More information about the samba-technical mailing list