File ctime/mtime update inconsistencies

Stefan (metze) Metzmacher metze at
Wed Jul 16 16:41:07 GMT 2008

Atte Peltomaki schrieb:
> 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. 

I know

> 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
> option. 

We know set the mtime to the current time at close, unless
the client explicit set the mtime before on the handle.

> 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. 

If you always want to set the mtime on close to the current value
no matter what the client wanted, then I assume it's possible to
implement that in a vfs module with a close() hook.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url :

More information about the samba-technical mailing list