Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2012 08:59:19 +0200
From:      Peter Holm <peter@holm.cc>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: close() of an flock'd file is not atomic
Message-ID:  <20120710065919.GA7051@x2.osted.lan>
In-Reply-To: <201207091648.32306.jhb@freebsd.org>
References:  <201203071318.08241.jhb@freebsd.org> <201207091138.15655.jhb@freebsd.org> <20120709204007.GW2338@deviant.kiev.zoral.com.ua> <201207091648.32306.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 09, 2012 at 04:48:32PM -0400, John Baldwin wrote:
> 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.
> 

I'll do that.

Regards,

- Peter



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