From owner-freebsd-current@FreeBSD.ORG Thu Nov 20 22:33:22 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 EA7E61065673 for ; Thu, 20 Nov 2008 22:33:22 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by mx1.freebsd.org (Postfix) with ESMTP id 608868FC1A for ; Thu, 20 Nov 2008 22:33:21 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by nf-out-0910.google.com with SMTP id h3so356173nfh.33 for ; Thu, 20 Nov 2008 14:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=sn7DTIiKnv1his59DJf6/8w+4jzH3/q1jJRFyhMOLeE=; b=pbPLLcK7q5SOKHOOiidMz7O1Ft4/sMhsucoBaA7xTLJKPSf1VequnCLelHXji7HaNl y7o8M1J4NYPd5DJxrZiQoYuIAYd7kHoB6WTybu4nrdwsaBiEGoXyplh+lz7st9qQnbK4 NFqI9qpkih6yrkC9aqboPsAdOjrmJXBZqdgo0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=Acs2KqEmVfthcU40gor7/kUQChHKIqC+/pbf8W6oZwhmJmAa2L/Z/nGvE6tZdCo2Rv Xb3Vgza/Vd6IRrXDmifHiH/YBTc7uAjsCM+bHLKj1Q+qHK2PVQ49YZ/TMRO1qrokkT/m 926tReb/NLMXQcEYxwdniC7W85cge32ZZ1w0M= Received: by 10.103.226.20 with SMTP id d20mr971672mur.8.1227220400666; Thu, 20 Nov 2008 14:33:20 -0800 (PST) Received: by 10.103.239.14 with HTTP; Thu, 20 Nov 2008 14:33:20 -0800 (PST) Message-ID: <3bbf2fe10811201433u16797213vf762099c48057cd@mail.gmail.com> Date: Thu, 20 Nov 2008 23:33:20 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "John Baldwin" In-Reply-To: <200811201726.43467.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811201627.58289.jhb@freebsd.org> <3bbf2fe10811201402x4eb6fa70i398bfb1402792fef@mail.gmail.com> <200811201726.43467.jhb@freebsd.org> X-Google-Sender-Auth: 017d7738cf28d2cf 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:33:23 -0000 2008/11/20, John Baldwin : > 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. Yeah, we could fix that also. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein