close() of an flock'd file is not atomic

Konstantin Belousov kostikbel at gmail.com
Mon Jul 9 20:40:12 UTC 2012


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.

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20120709/fd302909/attachment.pgp


More information about the freebsd-fs mailing list