File ctime/mtime update inconsistencies

Atte Peltomaki atte.peltomaki at
Wed Jul 16 11:24:49 GMT 2008

On Tue, Jul 15, 2008 at 04:27:25PM +0200, Stefan (metze) Metzmacher wrote:
> Atte Peltomaki schrieb:
> > Problem: neither ctime nor mtime attributes are consistently updated
> > when new files are created or existing ones replaced. 
> The problem is that samba3 doesn't store the ctime and not filesystems
> doesn't have a way to set the ctime.
> We always return the mtime as change_time and last_write_time,
> but only update the mtime to the last_write_time from the client.

This would be implementable for FreeBSD UFS2 due to it's support for
btime, which is equivalent for win32 ctime. 

Without this implemented and on other platforms/filesystems, respecting 
windows clients request to preserve the mtime causes practical problems:
Files cannot be reliably deleted based on how long they have been on a
share, and rsync must be used with the checksum option when run from
crontab, otherwise large files may get rsync'ed while still being
transferred and not get re-rsync'ed afterwards. 

Therefore, I suggest the behaviour is either changed to always use
current time when closing files after a write operation, or, if this is
unacceptable due to violating windows semantics, make it a configurable

Third option would be to implement it as a vfs module, though I think
doing this would be a bit overkill, especially since due filesystem
differences, the actual semantics will be different anyway. 


 \   ______//     Atte Peltomäki - atte.peltomaki at
  \  \\____        UNIX System Administrator - IT Server Team
   \   __//    F-Secure Corp. PL 24, FIN-00181 Helsinki, Finland
    \  \\     Tel: +358 9 2520 0700,     direct: +358 9 2520 5423
     \ //         
      \/         Integrated Solutions for Enterprise Security

More information about the samba-technical mailing list