[linux-cifs-client] SMB_COM_CLOSE and LastWriteTime
Guenter Kukkukk
linux at kukkukk.com
Wed Apr 23 15:22:25 GMT 2008
Am Mittwoch, 23. April 2008 schrieb Jeff Layton:
> I've had a couple of people open bugs complaining that "cp -p" to a
> Linux CIFS mount of a Windows share doesn't properly preserve the
> mtime. It appears that the system calls relating to the destination
> file are something like:
>
> open()
> write(), write(), ...
> futimes()
> close()
>
> I wrote a small test program to see where it was falling down, and what
> seems to happen is that the futimes() call sets the time properly on
> the server but then the close() makes the server clobber the mtime.
>
> On the wire, I can see a SET_PATH_INFO call that sets the mtime, and
> then the client sends a close request with the last write time set to
> 0xffffffff. Wireshark interprets this as "no time specified".
>
> After this Close request, the windows server (win2k3 in this case) sets
> the mtime to the current time of the server. Interestingly samba seems
> to handle this "correctly" and doesn't change the mtime on the close.
>
> This really seems like a Windows bug IMO, but since windows is really
> the reference implementation, perhaps CIFS is doing this wrong. Does
> anyone have insight into what value we should be sending in the
> LastWriteTime to tell windows not to touch the mtime? Or is there some
> other way to make this happen?
>
> Thanks,
Hi Jeff,
have a look at my post "[linux-cifs-client] Re: timestamp problems with cp -p"
dated 13th March 2008.
Included there is a _first_ patch which solved this problem for me - but there's
another place in the source, where a similar code sequence is used.
I've written a test applet to check the circumstances.
Will add some more info about that later today - need to go now.
See some further notes and listings in my 3 posts
"linux-cifs-client] Re: set last write time = fsync ?" dated 14th March 2008.
Cheers, Günter
More information about the linux-cifs-client
mailing list