[PATCH] Make udf(4) MPSAFE and use shared lookups
John Baldwin
jhb at freebsd.org
Thu Nov 20 14:48:21 PST 2008
On Thursday 20 November 2008 05:33:20 pm Attilio Rao wrote:
> 2008/11/20, John Baldwin <jhb at freebsd.org>:
> > On Thursday 20 November 2008 05:02:29 pm Attilio Rao wrote:
> > > 2008/11/20, John Baldwin <jhb at freebsd.org>:
> > > > So this patch is fairly minimal since udf(4) is currently read-only.
The
> > > > changes include:
> > > >
> > > > * Set VV_ROOT in udf_vget() if we ever return a vnode instead of
doing it
> > only
> > > > in udf_root(). This matches the behavior of other operating
systems and
> > > > correctly tags the root vnode with VV_ROOT in the unlikely case
that we
> > > > create the vnode during a call to ufs_vget() that does not come
from
> > > > ufs_root().
> > > > * If the hash lookup in ufs_vget() fails, ensure an exclusive vnode
lock
> > is
> > > > used while creating the new vnode (same as UFS).
> > > > * Allow lock recursion (XXX: not really sure this is needed
actually).
> > > > * Allow shared vnode locks on non-fifos.
> > > > * Honor the requested locking flags (shared vs exclusive) instead of
> > always
> > > > using exclusive vnode locks during a lookup operation.
> > > > * Handle "." lookups the same way other filesystems do by just
bumping
> > the
> > > > reference on 'dvp' rather than calling udf_vget().
> > > >
> > > > http://www.FreeBSD.org/~jhb/patches/udf_mpsafe.patch
> > >
> > > @@ -589,6 +582,22 @@
> > > if (error || *vpp != NULL)
> > > return (error);
> > >
> > > + /*
> > > + * We must promote to an exclusive lock for vnode creation. This
> > > + * can happen if lookup is passed LOCKSHARED.
> > > + */
> > > + if ((flags & LK_TYPE_MASK) == LK_SHARED) {
> > > + flags &= ~LK_TYPE_MASK;
> > > + flags |= LK_EXCLUSIVE;
> > > + }
> > > +
> > >
> > > On -CURRENT, operations are bitwise (differently from 7.x and such).
> > > What you want to do is just:
> > > flag = (flag & ~LK_SHARED) | LK_EXCLUSIVE;
> >
> >
> > I just copied and pasted from UFS in HEAD.
>
> Yeah, we could fix that also.
Although this code will likely be MFC'd to 7.x, so I'd rather do it in a 7.x
friendly manner for now.
--
John Baldwin
More information about the freebsd-current
mailing list