Bug in reply_write_and_X?

Conrad Minshall conrad at apple.com
Sat Dec 7 09:43:00 GMT 2002

I'm testing my smb client against Samba on FreeBSD.  The server's 
local filesystem has a maximum filesize of 16 Terabytes.  If my 
client attempts a writex with an offset of exactly 16TB then I see 
ERRnoaccess rather than ERRdiskfull.  Looking at some 3.0 sources, it 
appears reply_write_and_X() assumes that if write_file() returns zero 
(nwritten) then an access error is presumed and reported.  But if the 
offset is 16TB minus 1 then one byte is written and ERRdiskfull comes 

For now I put this comment (below) in my client.  Hopefully I'm 
overlooking something obvious.  Anyone have other ideas for a 
workaround (detecting when ERRdiskfull should have been returned)?

          * There is a case for which server(s) return
          * ERRnoaccess but should return ERRdiskfull: When
          * the offset for a write is exactly the server
          * file size limit then Samba (at least) thinks
          * the reason for zero bytes having been written
          * must have been "access denied" from the local
          * filesystem.  This cannot be easily worked
          * around since the server behaviour is
          * indistinguishable from actual access denied.
          * An incomplete workaround: attempt a 2 byte write
          * from "offset-1".  (That may require reading at
          * offset-1 first.)  The flaw is that reading or
          * writing at offset-1 could cause an
          * unrelated error (due to a byte range lock
          * for instance) and we can't presume the
          * order servers check errors in.

More information about the samba-technical mailing list