From owner-freebsd-current@FreeBSD.ORG Thu Nov 20 22:32:00 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64BA1106564A; Thu, 20 Nov 2008 22:32:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id D75588FC14; Thu, 20 Nov 2008 22:31:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mAKMVqP8069152; Thu, 20 Nov 2008 17:31:53 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "Attilio Rao" Date: Thu, 20 Nov 2008 17:26:43 -0500 User-Agent: KMail/1.9.7 References: <200811201627.58289.jhb@freebsd.org> <3bbf2fe10811201402x4eb6fa70i398bfb1402792fef@mail.gmail.com> In-Reply-To: <3bbf2fe10811201402x4eb6fa70i398bfb1402792fef@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811201726.43467.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Thu, 20 Nov 2008 17:31:53 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8654/Thu Nov 20 14:51:00 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: scottl@freebsd.org, current@freebsd.org Subject: Re: [PATCH] Make udf(4) MPSAFE and use shared lookups X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 22:32:00 -0000 On Thursday 20 November 2008 05:02:29 pm Attilio Rao wrote: > 2008/11/20, John Baldwin : > > 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. -- John Baldwin