close() of an flock'd file is not atomic
John Baldwin
jhb at freebsd.org
Thu Jun 7 12:37:52 UTC 2012
On Wednesday, June 06, 2012 4:34:23 pm Bruce Evans wrote:
> 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?
I have no idea. :( I will take it out of fhopen() however since presumably
fhopen() will not be used on devices (devfs doesn't have VOPs for
filehandles and is not exportable).
--
John Baldwin
More information about the freebsd-fs
mailing list