Date: Thu, 20 Nov 2008 17:43:56 -0500 From: John Baldwin <jhb@freebsd.org> To: "Attilio Rao" <attilio@freebsd.org> Cc: scottl@freebsd.org, current@freebsd.org Subject: Re: [PATCH] Make udf(4) MPSAFE and use shared lookups Message-ID: <200811201743.56963.jhb@freebsd.org> In-Reply-To: <3bbf2fe10811201433u16797213vf762099c48057cd@mail.gmail.com> References: <200811201627.58289.jhb@freebsd.org> <200811201726.43467.jhb@freebsd.org> <3bbf2fe10811201433u16797213vf762099c48057cd@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 20 November 2008 05:33:20 pm Attilio Rao wrote: > 2008/11/20, John Baldwin <jhb@freebsd.org>: > > On Thursday 20 November 2008 05:02:29 pm Attilio Rao wrote: > > > 2008/11/20, John Baldwin <jhb@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811201743.56963.jhb>