From owner-svn-src-head@FreeBSD.ORG Mon Mar 30 03:47:34 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D999FE43; Mon, 30 Mar 2015 03:47:33 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0B1877; Mon, 30 Mar 2015 03:47:32 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 0A4A8D438EC; Mon, 30 Mar 2015 14:47:30 +1100 (AEDT) Date: Mon, 30 Mar 2015 14:47:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker Subject: Re: svn commit: r280308 - head/sys/fs/devfs In-Reply-To: <20150329175137.GD95224@stack.nl> Message-ID: <20150330140932.D1560@besplex.bde.org> References: <20150322162507.GD2379@kib.kiev.ua> <201503221825.t2MIP7jv096531@gw.catspoiler.org> <20150329175137.GD95224@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=A5NVYcmG c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=nYMK6N0ycnvhnCZl4OQA:9 a=CjuIK1q_8ugA:10 Cc: src-committers@freebsd.org, Don Lewis , svn-src-head@freebsd.org, delphij@freebsd.org, brde@optusnet.com.au, kostikbel@gmail.com, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2015 03:47:34 -0000 On Sun, 29 Mar 2015, Jilles Tjoelker wrote: > On Sun, Mar 22, 2015 at 11:25:07AM -0700, Don Lewis wrote: >> It's not totally worthless. I think the mtime on tty devices is used to >> calculate the idle time that is printed by the w command. We just don't >> need nanosecond accuracy for that. > > Hmm. The idle time on tty devices breaking is a clear POLA violation, > but I'm not sure what's the best way to fix it. By the way, w uses atime > and who -u uses mtime. POSIX specifies that the idle time is the time since _any_ activity occured on the terminal; the method of determining this time is unspecified. So both w and who -u are arguably wrong. They could look at both the mtime and the atime, and possibly even the ctime and the btime, and more (a device i/o time, which is not available). But looking at the atime alone is reasonable. It gives a time related to the user typing on the terminal. This depends on the user's application reading the output and something (hopefully not just w) updating the atime. mtime updates are related to the application writing the terminal, and this can happen without the user being present. > Some options are: > > * Bypass vfs_timestamp() and hard-code second accuracy in devfs; > futimens() will still set timestamps to the nanosecond, even with > UTIME_NOW. A timestamp update after UTIME_NOW setting may set back the > timestamp to an older value. Probably enough, but I worry about the times going backwards. calcru() has complicated code to give monotonic times, but still spams to console and gives broken times when the times would have gone backwards without the correction. > * Make vfs.timestamp_precision filesystem-specific. Since this does not > affect futimens() with explicit timestamps, it will not cause strange > situations with cp -p. I could use this, but it is too complicated. I sometimes run tests which need to change the precision. I want this only on the filesystem running the tests, but get it globally. So I try to change it only transiently, but sometimes forget to change back. > * Restrict file times on devfs to seconds. This is reasonable. It gives the same bug as the seconds resolution setting (that timestamps are more than 1 second in the past despite sychronization that would prevent this if the system conformed to POSIX) because time_second lags clocks that read the hardware. > * Somehow add a special case for TTY devices so they will always keep > timestamps. > > * Somehow add a special case for "performance-critical" devices so they > will not keep timestamps. > > * Change the default for vfs.timestamp_precision to 1, which still > provides non-zero nanoseconds (so much of the same bugs) but is not so > slow. The file server people won't like this though. Monotonic and unique is probably enough. > My proposal for delayed updates as in UFS clearly does not work for TTY > idle times, so there is no point in that. It gives what ufs always did when device files were on it instead of on devfs. The immediated devfs updates don't give correct atimes either. The atime is only set when something reads the tty, but the user's activity may be much earlier than that (when the application doing the reading is delayed, perhaps significantly in actual use by the application being stopped or buffering). But the delays are usually short. Users would complain if input is not acted on by more than the tty driver echo within 20 milliseconds. Even more so if the echo/action is done by the application. Bruce