From owner-freebsd-fs@FreeBSD.ORG Wed Jun 6 20:34:34 2012 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFD99106564A; Wed, 6 Jun 2012 20:34:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 29CFA8FC1B; Wed, 6 Jun 2012 20:34:33 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q56KYNUa013150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Jun 2012 06:34:24 +1000 Date: Thu, 7 Jun 2012 06:34:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov In-Reply-To: <20120606183949.GR85127@deviant.kiev.zoral.com.ua> Message-ID: <20120607062703.P955@besplex.bde.org> References: <201203071318.08241.jhb@freebsd.org> <201203091059.29342.jhb@freebsd.org> <201203161406.27549.jhb@freebsd.org> <201206060817.54684.jhb@freebsd.org> <20120606183949.GR85127@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@FreeBSD.org, pho@FreeBSD.org, John Baldwin Subject: Re: close() of an flock'd file is not atomic X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 20:34:34 -0000 On Wed, 6 Jun 2012, Konstantin Belousov wrote: > On Wed, Jun 06, 2012 at 08:17:54AM -0400, John Baldwin wrote: >>... >> The vn_open_vnode() patch is at >> http://www.freebsd.org/~jhb/patches/vn_open_vnode.patch >> >> I tested it by doing a buildworld -j 32 in a loop while NFS exporting the >> /usr/obj tree to another machine that did a continual find | xargs md5 loop >> over the /usr/obj tree. This survived overnight. > > There is #if 0 left in fhopen() which translates ERESTART into EINTR. Is > it needed ? > > Otherwise it looks fine (but still quite hard to read). This translation in the old code causes the following bogus behaviour: - some device drivers try to restart open() after revoke(). They return ERESTART for this. But open never restarts, due to this translation. Never restarting may be correct, but EINTR is a bogus errno unless the open was actually interrupted by a signal, in which case the driver should have returned EINTR. ENXIO is closest to describing "killed by revoke". What case is the translation supposed to fix? Bruce