Samba 3.0.32 - file last write time

Jeremy Allison jra at
Thu Sep 4 20:58:14 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, looking at the 3.2.x codebase this should work, as
the returned write time is always retrieved from the
share mode info.

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

Yes, I'm guessing I should check that qpathinfo returns
the updated write time 2 seconds after the SMB_WRITE
with zero size (it probably won't in 3.2.x at the


More information about the samba-technical mailing list