modtime not preserved on copying onto samba share - got the

Andrej Borsenkow borsenkow.msk at
Tue Oct 20 13:47:30 GMT 1998

> > >
> > > NT create & X
> > > SMBwrite - wites 0 bytes *at the end of file* (creating empty file)
> > > transact2 set file info -
> > > transact2 set file info - one of them (dunno) correctly sets
> file times
> > > SMBwrite - writes the rest of file, thus resetting all file times :((
> > >

Just to add - the final SMBclose does *not* have a "last write time" set. It
happens only, if NT SMB suport is turned on.

It seems, that on NT modtime attribute is sticky. Try to copy large file
onto NT - modtime is set once (as in above session) and remains untouched.
It probably is different from creation time caching discussed on NTBUGTRAQ -
here it applies to write time. I have a theory (actually, more than one :),
how it happens - but net effect is, if SAMBA claims to be NT, it *must*
cache last write time to correctly set it after file was closed.

How can we decide, if we speak with NT? The sequence probably looks like

  if speaking with NT
     create file - mark file as "being created"
     set file times - cache them
     close - if file "being created", set cached file times

Should file qery return information from cache or from "real" file? To be
compatible with NT - probably from cache.

I am ready to implement it, as long as it is limited to NTcreateX. I hardly
can study the whole sources to find all possible cases :((


More information about the samba-technical mailing list