ext4 - getting at birth time (file create time) and getting/setting nanosecond time stamps and utime

Andreas Dilger adilger at sun.com
Tue Oct 20 14:33:37 MDT 2009

On 20-Oct-09, at 06:44, jim owens wrote:
> Andreas Dilger wrote:
>> On 19-Oct-09, at 16:24, Steve French wrote:
>>> On Mon, Oct 19, 2009 at 3:11 PM, Andreas Dilger <adilger at sun.com>  
>>> wrote:
>>>> As for being able to write to the "create time" attribute, I  
>>>> would prefer
>>>> that this be a filesystem mount option.  For some users (myself  
>>>> included)
>>>> I don't care whether Windows is unhappy that it can't update this  
>>>> creation
>>>> time - I'd prefer to know when a file is actually created.
>>> I agree - if create time could be overwritten - that behavior  
>>> hould be
>>> configurable (another post mentioned the alternative to mount
>>> option - a flag for this perhaps along the lines of the a "backup  
>>> intent"
>>> flag - although somewhat different than what Windows uses that for).
>> If this is a flag that a user can configure/select themselves, then  
>> it
>> is completely useless to me.  If it is a mount option and/or  
>> possibly an
>> additional process capability that would be more useful.
> Restricting the modification of create time is pointless.

You contradict yourself later.  What we have NOW is creation timestamps
inside on-disk metadata structures the filesystem does not expose.
Going a step further - to expose this in a read-only manner does not
remove the usefulness of this field, but making it read-write does.

For those users/admins that want to be able to change this (due to
Samba, or whatever), great, we can give them this ability, but for
users who do NOT want regular users to be able to change the file
creation timestamp, that should be possible as well.

> A number of filesystems and operating systems besides windows
> have create time and it MUST be settable on restore just like
> the access and modification times.

It seems those other systems can't choke _too_ badly, given that
they don't have creation timestamps today and seem to work fine.
Since no Unix tools or applications depend on the presence of this
field, I would say that the default be to NOT allow this timestamp
to be changed.

> There is no value in it needing "special privileges".  What
> you are forgetting is *NO* timestamp on a filesystem can be
> trusted to be correct.  All times are just fields set based
> on what the system thinks the time is now (not to mention that
> any disk editor can change the field).  The "now time" can be
> intentionally or accidentally set wrong, or as has happened to
> me, a totally crap value from a bad RTC battery. :)

> On the other hand, if you just want stamps for debugging
> and internal purposes, then you do what I did, put versions
> and times inside on-disk metadata structures the filesystem
> does not expose.  As long as you remember all stamps are still
> at the mercy of those who can patch your clock, your code,
> and your raw disk blocks.

Sure, if you give every user write permission to the disk, then
every bit of security is meaningless, but I don't expect that
many sysadmins will do this.  For a single-user system, they
can do whatever they want in the end, so preventing regular
users from changing the timestamp is no hindrance to them in the
end either.

Cheers, Andreas
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

More information about the samba-technical mailing list