Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 12:59:53 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        src-committers@freebsd.org, Jilles Tjoelker <jilles@stack.nl>, svn-src-all@freebsd.org, delphij@freebsd.org, Bruce Evans <brde@optusnet.com.au>, svn-src-head@freebsd.org, Don Lewis <truckman@freebsd.org>
Subject:   Re: svn commit: r280308 - head/sys/fs/devfs
Message-ID:  <20150401124524.B1349@besplex.bde.org>
In-Reply-To: <20150330103355.GD2379@kib.kiev.ua>
References:  <20150322162507.GD2379@kib.kiev.ua> <201503221825.t2MIP7jv096531@gw.catspoiler.org> <20150329175137.GD95224@stack.nl> <20150329184238.GB2379@kib.kiev.ua> <20150330145148.C1660@besplex.bde.org> <20150330103355.GD2379@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 30 Mar 2015, Konstantin Belousov wrote:

> On Mon, Mar 30, 2015 at 03:14:10PM +1100, Bruce Evans wrote:
>> File timestamps use CLOCK_REALTIME, so they are supposed to go backwards
>> sometimes.  More importantly, if the time is set to a future time (by
>> utimes(), etc., not due to a clock step), this prevents it being correted.
>> I think you only want to do a null update if tv_nsec is nonzero due to a
>> previous setting with vfs_timestamp(), and the new second hasn't arrived
>> yet.  Something like:
>>
>>  		if (tsp->tv_sec != ts) ...
>>
>> If '<', then as above.  If '>', it means a correction by >= 1 second
>> (strictly greater if tv_nsec != 0).  The initial value tv_nsec is
>> irrelevant in both cases.

The future times happen often in practice.  Any time the system is on
local time East of Greenwich, using a device file early in the boot
sets its timestamps in the future (9-11 hours here).  Then using the
file later should set it to the current time without waiting until
the future time is reached.

> Below is the updated patch.  I also added a comment to devfs_timestamp(),
> please reformulate it to your liking.

I like this version.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150401124524.B1349>