I add some technical background to my prior posting and attach a
patch to the problem.

I think the change made to the Bug #2045 has two problems.
(1) It can't handle PowerPoint 2000 behavior of changing
timestamps.
(2) A process for TRANS2/SETPATHINFO is degraded.


- About behavior of changing timestamps
[Phenomenon]
Last access time (mtime in samba-side file system) of a .ppt file
becomes not an original time (Windows behavior) but a file opened
time after the file was accessed at the following situations.

(1) At the first access after a ppt file was newly created and
saved without any editing

(2) At the alternated access to the same file from multiple client
computers by write permitted users.

These are observed in the following environment.
OS: Windows 2000 SP4 and Windows XP SP2
PPT: PowerPoint 2000 SP3

[cause]
The PowerPoint opens two file descriptors (fd) at the same time.
When the first fd is opened, the PowerPoint modify last access
time of the file with client-side time. And the second fd is
opened, it rolls back the last access time to the original time.

Because the samba suspends a change of timestamp until closing a
file, the last access time does not return to an original time
depending on the timing of two closes.

[action]
In addition to the change to the Bug #2045, eliminating utime() at
the closing time is needed.


- About degrading for TRANS2/SETPATHINFO processing
At call_trans2setfilepathinfo() in smbd/trans2.c, original source
has a process for fsp == NULL but patch-aplied source does not
have that (it is merged to a process for fsp != NULL. Why?).

The process for 'fsp == NULL' is executed when the samba receives
a TRANS2/SETPATHINFO requests. Therefore even if the
TRANS2/SETPATHINFO includes a request of modifying timestamps, it
is ignored.

Windows might not issue TRANS2/SETPATHINFO in order to modify
timestamps while smbfs of Linux does.


Attached patch deals with above two problems.

---
Kenichi Miyata
ke_miyata@itg.hitachi.co.jp

================================================
diff -uNr samba.org/source/smbd/close.c samba/source/smbd/close.c
--- samba.org/source/smbd/close.c Mon Feb 16 10:13:38 2004
+++ samba/source/smbd/close.c Tue Feb 22 11:35:56 2005
@@ -213,16 +213,6 @@
check_magic(fsp,conn);
}

- /*
- * Ensure pending modtime is set after close.
- */
-
- if(fsp->pending_modtime) {
- int saved_errno = errno;
- set_filetime(conn, fsp->fsp_name, fsp->pending_modtime);
- errno = saved_errno;
- }
-
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
conn->user,fsp->fsp_name,
conn->num_files_open, err ? strerror(err) : ""));
diff -uNr samba.org/source/smbd/reply.c samba/source/smbd/reply.c
--- samba.org/source/smbd/reply.c Mon Feb 16 11:18:22 2004
+++ samba/source/smbd/reply.c Tue Feb 22 11:36:20 2005
@@ -3807,9 +3807,6 @@

close_file(fsp1,False);

- /* Ensure the modtime is set correctly on the destination file. */
- fsp2->pending_modtime = src_sbuf.st_mtime;
-
/*
* As we are opening fsp1 read-only we only expect
* an error on close on fsp2 if we are out of space.
@@ -3817,6 +3814,9 @@
* close of fsp1.
*/
*err_ret = close_file(fsp2,False);
+
+ /* Ensure the modtime is set correctly on the destination file. */
+ set_filetime(conn,dest,src_sbuf.st_mtime);

return(ret == (SMB_OFF_T)src_sbuf.st_size);
}
diff -uNr samba.org/source/smbd/trans2.c samba/source/smbd/trans2.c
--- samba.org/source/smbd/trans2.c Tue Feb 22 14:51:25 2005
+++ samba/source/smbd/trans2.c Tue Feb 22 11:34:59 2005
@@ -3094,11 +3094,12 @@
fsp->pending_modtime = tvs.modtime;
}

- DEBUG(10,("call_trans2setfilepathinfo: setting utimes to modified values.\n"));
+ }

- if(file_utime(conn, fname, &tvs)!=0) {
- return(UNIXERROR(ERRDOS,ERRnoaccess));
- }
+ DEBUG(10,("call_trans2setfilepathinfo: setting utimes to modified values.\n"));
+
+ if(file_utime(conn, fname, &tvs)!=0) {
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
}
}