Don't overwrite creation time if set by make_create_timespec

Ralph Böhme rb at
Wed Mar 12 07:40:27 MDT 2014

Hi Jeremy,

thanks for looking into this.

On Tue, Mar 11, 2014 at 04:59:03PM -0700, Jeremy Allison wrote:
> On Mon, Mar 10, 2014 at 05:59:41PM +0100, Ralph Böhme wrote:
> > smb2_create calls dos_mode() after calling SMB_VFS_CREATE_FILE(), as a
> > result the creation time as set by make_create_timespec() is always
> > overwritten.
> > 
> > Add a check to dos_mode() that tests for st_ex_calculated_birthtime ==
> > true and only then update the creation time with the value from the
> > DOS attribute xattr.
> > 
> > Review appreciated. Thanks!
> OK, I'm not sure this change is correct. What bug are
> you trying to fix here ?

not being able to set st_ex_btime from a VFS module without being
overwritten by dos_mode().

I'm working on a new VFS module with enhanced streams support for
Apple SMB clients and other stuff like Netatalk metadata compatibiliy
[1].  In the VFS module's stat() routines I'm reading a files creation
date from Netatalk's stored Apple metadata and use that value for
setting btime.

vfs_gpfs sets btime too (vfs_gpfs.c:1493), so its likely to run into
the same issue.

> In Win32, the SetFileTime() call can change the
> creation time on a file, so create time is not
> immutable. Because of that, overwriting the
> create time stored in the EA with the one from
> the filesystem is not always the right thing
> to do, even if the filesystem stores create
> time.

I see. So what would be needed is a proper way to let VFS modules set
btime without dos_mode() overwriting it. *scratches head*


[1] <>

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen,

More information about the samba-technical mailing list