[PATCH] Fix bug #3124 - xcopy /d with samba shares works not as aspected

David Disseldorp ddiss at suse.de
Fri May 23 11:15:22 MDT 2014


Hi Jeremy,

Both code changes look good, but I don't think this should be tagged
as a fix for bso#3124.

Please remove the tags and push to master with:
Reviewed-by: David Disseldorp <ddiss at samba.org>

Also, please consider the attached smbtorture patch for inclusion.

Cheers, David

On Wed, 21 May 2014 12:26:08 -0700, Jeremy Allison wrote:

> The reporter (Andrew Klosterman) revived this old
> bug, and did an amazing analysis of the problem
> that nailed it completely.
> 
> In short, the SMB2 create code path doesn't
> correctly return rounded timestamps from the
> filesystem whereas all other paths through
> the server (SMB1 and SMB2) do so.
> 
> I realized this is because the SMB2 server
> code doesn't call the wrapper function
> put_long_date_timespec() that automatically
> takes care of this.
> 
> 2 patches are attched, #1 fixes the
> existing SMB2 close code to use struct timespec
> internally, not directly use NTTIME, and
> to call put_long_date_timespec() instead of
> hand-marshalling the timestamps and doing
> the rounding itself. This code was already
> doing the right thing (rounding) but the
> problem was by doing it by hand and not
> going through the API used everywhere else
> it's easy to forget to do the rounding, and
> make mistakes :-).
> 
> Patch #2 fixes the SMB2 create code to
> do the same (use struct timespec internally,
> not directly use NTTIME) and call put_long_date_timespec()
> instead of hand-marshalling the timestamps.
> This was the code path that had forgotten
> to do the rounding. Oops :-).
> 
> The simplest fix would have been to
> add the round_timespec() calls to the
> create codepath, but that then leaves
> us with a server that uses one API
> to write out file times for all the SMB2
> functions called through the SMB2_GETINFO
> code paths, and a *different* (although
> functionaly equivalent) set of APIs
> being used in the SMB2_CLOSE and SMB2_CREATE
> code paths. That disturbed me :-).
> 
> With these two patches all the server
> code that deals with file timestamps
> uses struct timespec internally, and
> only does the conversion to NTTIME at
> the last marshalling step. Should lead
> to fewer bugs in future IMHO :-).
> 
> Please review and push if happy !
> 
> These patches are for mater, patches for
> 4.1.x and 4.0.x are attached to the bug:
> 
> https://bugzilla.samba.org/show_bug.cgi?id=3124
> 
> Jeremy.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-torture-smb2-dir-check-create-time-match-find.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140523/aedc2568/attachment.bin>


More information about the samba-technical mailing list