SMB_SET_FILE_BASIC_INFO
Michael C. Adler
Michael.Adler at compaq.com
Thu Oct 7 02:37:12 GMT 1999
See attached diff -c.
-Michael
Jeremy Allison wrote:
>
> Michael C. Adler wrote:
> >
> > I apologize if this has been hashed out before. I looked in the
> > archives and didn't find anything.
> >
> > I've been trying to get robocopy to work from an NT filesystem, copying
> > to a Unix filesystem using Samba. I finally figured out why it doesn't
> > work.
> >
> > In trans2.c/call_trans2setfilepathinfo(), the code that handles the
> > SMB_SET_FILE_BASIC_INFO case takes the MAX of the write time and the
> > changed time. I believe Microsoft actually uses the changed (creation)
> > time as the changed time of the file for the purposes of backups. The
> > write time is the last time the contents were changed.
> >
> > robocopy depends on being able to set the last write time. If it fails,
> > it doesn't know what to do the next time it is run. Samba is forcing
> > the time to be the latter of the write time and the creation time.
> > Unfortunately, if a file is copied to a new location on NTFS, the write
> > time is kept old and the creation time is set new. This means that it
> > is very easy to get a file in a state on NTFS such that copying it to a
> > Samba server will set a relatively new modtime even thought the write
> > time on NTFS is old.
> >
> > As an experiment, I changed the modtime computation in
> > call_trans2setfilepathinfo to use only pdata+16 (write time) and ignore
> > changed time (pdata+24) when handling SMB_SET_FILE_BASIC_INFO. I think
> > this works for me and may be what others want. I doubt it works for
> > everyone. Does it deserve a mode in smb.conf?
>
> Can you send me the diffs for this patch please ? I'd like to
> understand exactly what is being done here.
>
-------------- next part --------------
*** trans2.c.~1~ Tue Jul 20 21:25:21 1999
--- trans2.c Wed Oct 6 22:33:19 1999
***************
*** 1663,1671 ****
/* access time */
tvs.actime = interpret_long_date(pdata+8);
/* write time + changed time, combined. */
! tvs.modtime=MAX(interpret_long_date(pdata+16),
! interpret_long_date(pdata+24));
#if 0 /* Needs more testing... */
/* Test from Luke to prevent Win95 from
--- 1663,1680 ----
/* access time */
tvs.actime = interpret_long_date(pdata+8);
+ /*
+ * Use only the write time, not the creation time. Unix has no place
+ * to store both times. Write time on NT appears to be the time the
+ * data in the file was last modified. Create time may be updated when
+ * a file is copied to a new location even when the write date is
+ * preserved. Tools like robocopy depend on modtime holding the write
+ * time.
+ */
+ tvs.modtime=interpret_long_date(pdata+16);
/* write time + changed time, combined. */
! // tvs.modtime=MAX(interpret_long_date(pdata+16),
! // interpret_long_date(pdata+24));
#if 0 /* Needs more testing... */
/* Test from Luke to prevent Win95 from
More information about the samba-technical
mailing list