[Samba] NFS quotas: truncated files without warning

Jeremy Allison jra at samba.org
Fri Jun 15 17:54:20 GMT 2007


On Fri, Jun 15, 2007 at 10:48:58AM -0700, Jeremy Allison wrote:
> On Fri, Jun 15, 2007 at 07:44:22PM +0200, SER.RI-TIC - David Losada wrote:
> > Hi Jeremy,
> > 
> > thank you for the tip. Unfortunately, this hasn't proved succesful.. how
> > I tested it:
> > 
> > from W2K, as an user with a completely full quota, I drop a 11788 byte
> > file into the share. It produces the following system calls in the server:
> > 
> > write(25, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
> > 4096) = 4096
> > write(25, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
> > 4096) = 4096
> > write(25, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
> > 3596) = 3596
> > 
> > (4096+4096+3596 = 11788)
> > 
> > so my Samba is verifying the availability of storage space through the
> > write() system call, which doesn't generate NFS quota errors, ugh. The
> > thing is that an fsync() after these write() calls would probably get me
> > the NFS quota error... maybe it's implemented this way in a newer Samba
> > release?
> 
> Yes, that's what we do (I wrote the code :-). I'll add code to
> force an fsync after these writes if "strict sync" is also set.
> 
> I'll post the patch for 3.0.25 once I've done it.

Actually, I've checked the code and this should already be
being done.

The secret is to set :

strict allocate = yes
strict sync = yes
sync always = yes

So force the flush - normally we only do the fsync if the
client asks for it on the write call.

Jeremy.


More information about the samba mailing list