Date: Thu, 20 Nov 2008 23:33:20 +0100 From: "Attilio Rao" <attilio@freebsd.org> To: "John Baldwin" <jhb@freebsd.org> Cc: scottl@freebsd.org, current@freebsd.org Subject: Re: [PATCH] Make udf(4) MPSAFE and use shared lookups Message-ID: <3bbf2fe10811201433u16797213vf762099c48057cd@mail.gmail.com> In-Reply-To: <200811201726.43467.jhb@freebsd.org> References: <200811201627.58289.jhb@freebsd.org> <3bbf2fe10811201402x4eb6fa70i398bfb1402792fef@mail.gmail.com> <200811201726.43467.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10811201433u16797213vf762099c48057cd>