From owner-freebsd-fs@FreeBSD.ORG Mon Jul 9 20:51:22 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 3F273106564A; Mon, 9 Jul 2012 20:51:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 13FD58FC22; Mon, 9 Jul 2012 20:51:22 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6A5B9B963; Mon, 9 Jul 2012 16:51:21 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Mon, 9 Jul 2012 16:48:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201203071318.08241.jhb@freebsd.org> <201207091138.15655.jhb@freebsd.org> <20120709204007.GW2338@deviant.kiev.zoral.com.ua> In-Reply-To: <20120709204007.GW2338@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201207091648.32306.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Jul 2012 16:51:21 -0400 (EDT) Cc: freebsd-fs@freebsd.org, pho@freebsd.org 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: Mon, 09 Jul 2012 20:51:22 -0000 On Monday, July 09, 2012 4:40:07 pm Konstantin Belousov wrote: > On Mon, Jul 09, 2012 at 11:38:15AM -0400, John Baldwin wrote: > > Here now is the tested version of the actual fix after the vn_open_vnode() > > changes were committed. This is hopefully easier to parse now. > > > > http://www.FreeBSD.org/~jhb/patches/flock_open_close4.patch > > Do you need atomic op to set FHASLOCK in vn_open_cred ? I do not think > *fp can be shared with other thread there. Oh, that's true. I had just preserved it from the original code. > I thought that vrele() call in vn_closefile() would need a > vn_start_write() or vn_start_secondary_write() dance around it, but > now I believe it is not needed, since ufs_inactive() handles start of > secondary writes on its own. Still, it would be good if Peter could test > the patch with snapshotting load just be to safe there. Ok. I'm happy to have pho@ test it, but the test will have to use file locking along with snapshots to exercise this case. -- John Baldwin