Samba 3.0.32 - file last write time

Jeremy Allison jra at
Fri Sep 5 21:27:18 GMT 2008

On Thu, Sep 04, 2008 at 12:02:52PM +0200, Stefan (metze) Metzmacher wrote:
> Dina Fine schrieb:
> > Hello Jeremy 
> > 
> > Windows client doesn't update the file modification time on write
> > request if the file last write time was changed via SET_FILE_INFO.
> > I noticed that you handle this by setting the file mtime using the
> > pending mtime value on each write request (in real_write function)
> > But on empty write requests (offset = x, count  = 0) when only the file
> > size is allocated or shrunk, you don't do this (reply_write() in
> > reply.c)
> > 
> > So if the client opens a new file, sets the last write time (via
> > set_file_info request), then the first allocating write (offset = x,
> > count =0) will change the file mtime. In this case the findfirst on the
> > file will return the updated mtime and not the 'last write time'.
> > 
> > It seems that the following code (from real_write() function) should be
> > also called from write_reply when count = 0:
> Please note that the write time handling of samba 3.0.x doesn't match
> windows behavior, in samba 3.2.x the handling for write times has improved.

Yes, this test will pass against Samba 3.2.x I'm sure.

> But I assume samba 3.2.x has also the count = 0 problem.
> Jeremy could you please write a torture test for this:-)

I just added 3 torture tests that show that write time
update is immediate on SMBwrite with zero length, SET_END_OF_FILE_INFO
and SET_ALLOCATION_SIZE - no 2 second delay in these
cases. So we got this right in 3.2.x by accident (assuming you
didn't know this when you wrote the write time update
delay code :-).


More information about the samba-technical mailing list