From owner-svn-src-head@freebsd.org Wed Mar 23 23:42:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63230ADBC03; Wed, 23 Mar 2016 23:42:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id ED01E1FD1; Wed, 23 Mar 2016 23:42:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 7546F3C461A; Thu, 24 Mar 2016 10:22:31 +1100 (AEDT) Date: Thu, 24 Mar 2016 10:22:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Rick Macklem cc: Benjamin Kaduk , Bryan Drewery , "cem@FreeBSD.org" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r297201 - in head: share/man/man4 sys/dev/filemon In-Reply-To: <610790279.29237860.1458771051379.JavaMail.zimbra@uoguelph.ca> Message-ID: <20160324092330.X2963@besplex.bde.org> References: <201603222241.u2MMf7ub090070@repo.freebsd.org> <610790279.29237860.1458771051379.JavaMail.zimbra@uoguelph.ca> 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=KvuwojiN c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=uVdQFnm1dlgYBY5sB3MA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 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: Wed, 23 Mar 2016 23:42:58 -0000 On Wed, 23 Mar 2016, Rick Macklem wrote: > Benjamin Kaduk wrote: >> On Tue, Mar 22, 2016 at 9:11 PM, Bryan Drewery wrote: >>> >>> The manpage for close(2) does document some errors, one being ENOSPC. The >>> close(2) behavior of returning write(2), really VOP_WRITE(9), errors though >>> is specific to filemon since all of the writes are hidden and this is the >>> only place to return an error. I have a review open to resolve a similar >>> issue in alq(9) as well since all of the writes are asynchronous and >>> there's no API to retrieve any error from. >> >> filemon is not unique in this regard; the AFS filesystem buffers writes >> locally and in some cases errors writing to the remote server can be >> delayed until close(). Of course, very few softwares actually check the >> return value of close, so this can cause trouble sometimes... >> > Sorry, but I can't resist a little ancient history... > When NFS first showed up in the mid-1980s, the clients would flush writes > upon close() in order to detect write errors (usually ENOSPC) and return > them to the app. (typically a user trying to save their text edit when the > server was out of space or the user was out of quota). At least this way, > the editor could tell the user that their text file wasn't saved. I remember a long usenet thread which I didn't really understand at the time (around 1990?) about close() returning EDQUOT. FreeBSD actually documents close() returning ENOSPC. This error is almost never checked for of course. FreeBSD doesn't documented EDQUOT, at least in old versions. close() can also return EINTR, and FreeBSD documents this too. This error is almost never checked for of course. It is even harder to handle completely. In at least old versions of POSIX, the state of the fd when close returns EINTR is unspecifed. FreeBSD now documents that the fd is deallocated after all errors in close() except EBADF. > Somehow, the flush writes upon close to detect this morphed into "close > to open consistency", which was an AFS concept and not an NFS one > (which most NFS clients only implement approximately, given attribute > caching and modify time precision, but that's another story;-). I'm still getting better performance in all cases tested with the no- commit-on-close "optimization" turned off. But I only tested cases with the fs mounted with noasync on both the client and server. It makes sense that the optimization is negative in this case -- the commit-on-close doesn't really commit, since it is still async. So doesn't cause much delay. It moves doing the write RPCs earlier, which is better for throughput though worse for latency. It then gains without any losses (except perhaps weakening the approximation to "ctoc") by preventing the client discarding its cached data. Bruce