set_filetime problem

Juergen Hasch Hasch at
Sun Dec 16 04:27:02 GMT 2001

I want to come back to a message sent from Mike Black on the Samba list some 
time ago:

List:     samba
Subject:  set_filetime problem
From:     "Mike Black" <mblack at>
Date:     2001-06-01 11:45:55
[Download message RAW]

samba-2.2.0 on Linux 2.4.5

When copying a file from client to samba server the file date/time is set to 
the \
current time instead of the original file date/time. This works OK on 2.0.7

Problem appears to be in smbd/replyc.c reply_close()

The set_filetime works correctly.
But, the close_file() call flushes the write cache which updates the date/time 
on the \
file overruling the set_filetime.

set_filetime should be called AFTER close_file.  However close_file frees the 
fsp and \
pending_modtime so a copy will have to be made before close_file. \
________________________________________ Michael D. Black   Principal Engineer
mblack at  321-676-2923,x203  Computer Science Innovations  My home page
FAX 321-676-2355


I have the same problem here with current Samba_2_2 from CVS.
When I set the write cache size to > 0, the file dates are lost
when copying to a samba share.
The following patch seems to correct this behaviour:

--- reply.c.orig	Sun Dec 16 12:14:33 2001
+++ reply.c	Sun Dec 16 12:27:40 2001
@@ -2964,6 +2964,8 @@
 		int close_err;

+		/* flush write cache before setting mtime */
+		flush_write_cache(fsp, WRITE_FLUSH);
 		 * If there was a modify time outstanding,
 		 * try and set it here.

Should it be done differently ?

More information about the samba-technical mailing list