From owner-freebsd-current@FreeBSD.ORG Wed Dec 3 12:41:43 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 4C058106564A; Wed, 3 Dec 2008 12:41:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id E04998FC13; Wed, 3 Dec 2008 12:41:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L7r2z-000MSm-B8; Wed, 03 Dec 2008 14:41:41 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB3CfcNb077059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2008 14:41:38 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB3CfcrX002108; Wed, 3 Dec 2008 14:41:38 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB3CfbNp002107; Wed, 3 Dec 2008 14:41:37 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 Dec 2008 14:41:37 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081203124137.GE3045@deviant.kiev.zoral.com.ua> References: <200811201627.58289.jhb@freebsd.org> <200811211452.02545.jhb@freebsd.org> <20081122115028.GB6408@deviant.kiev.zoral.com.ua> <200812021828.36857.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="q/d9vTEvvdeKbPNw" Content-Disposition: inline In-Reply-To: <200812021828.36857.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L7r2z-000MSm-B8 32cefe2929b14db5a5928120c286b77c X-Terabit: YES 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: Wed, 03 Dec 2008 12:41:43 -0000 --q/d9vTEvvdeKbPNw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 02, 2008 at 06:28:36PM -0500, John Baldwin wrote: > On Saturday 22 November 2008 06:50:28 am Kostik Belousov wrote: > > udf_vget() does insmntque() before vnode is fully initialized, allowing > > other threads to find the vnode on the mount list. This is typical for > > !MPSAFE fs, and it seems corresponding call was not marked XXX for udf. >=20 > It does the same as ufs. ufs only partially initializes the i-node (as m= uch=20 > as both cd9660 and udf do) and then exclusive locks the vnode before=20 > insmntque(). They then finish initializing the i-node (bread() the d-nod= e,=20 > for example) and finally drop the vnode lock. My bad, unjustified grumbling. >=20 > > udf_lookup for ISDOTDOT case unlocks dvp before vget'ing "..", allowing > > the same race on forced unmount as ufs (I will finally commit ufs patch > > today). The race happens for !MPSAFE code too, but it is easier to > > execute without Giant. >=20 > Every fs is going to need this workaround it seems. Would be nice if the= re=20 > was an easier way to avoid cut and pasting this code N times. Perhaps we= =20 > could make lookup() check VI_DOOMED instead? I had changed it do that at= one=20 > point, but then someone pointed me at the deadfs stuff and said that was= =20 > sufficient. The point of the patch is busying mp while parent vnode is locked, that guarantees that mp is not unmounted during whole DOTDOT traversing in vop_lookup(). The deadfs stuff works for lookup result vnode and is sufficient. The fragment that someone committed into UFS can be extracted into the vfs support routine. I doubt that it can be embedded into lookup(). The problem is that some filesystems do additional operations inside vop_lookup(). --q/d9vTEvvdeKbPNw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk2foEACgkQC3+MBN1Mb4hA4QCfbOvumkkzfUeFlQNtEddszDdq rMwAnjCmPda6vAtxmlGFrclRn/KYE4DB =ikoi -----END PGP SIGNATURE----- --q/d9vTEvvdeKbPNw--