From owner-freebsd-fs@FreeBSD.ORG Tue Aug 5 08:32:35 2008 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FD961065677 for ; Tue, 5 Aug 2008 08:32:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id F27638FC1E for ; Tue, 5 Aug 2008 08:32:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 m758WUco066705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Aug 2008 11:32:30 +0300 (EEST) (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.2/8.14.2) with ESMTP id m758WUBn097207; Tue, 5 Aug 2008 11:32:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m758WTMj097200; Tue, 5 Aug 2008 11:32:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 5 Aug 2008 11:32:29 +0300 From: Kostik Belousov To: Rick Macklem Message-ID: <20080805083229.GB97161@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qnuS/wU1MXEWeKjo" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i 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 Cc: freebsd-fs@freebsd.org Subject: Re: doing vfs_hash_get when vnode locked X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2008 08:32:35 -0000 --qnuS/wU1MXEWeKjo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 04, 2008 at 05:04:58PM -0400, Rick Macklem wrote: > There's a place in my nfsv4 client where I need to vfs_hash_get() when > another blocked thread may be holding a lock on the vnode. (It's during > a recovery case where the other threads are blocked, so there isn't a > race problem, as far as I understand it.) >=20 > For FreeBSD7, all I did was call vfs_hash_get() with flags =3D=3D 0 and it > gave me what I wanted (the vnode for the file handle with a reference > count, but no lock). >=20 > For FreeBSD-CURRENT/8, this no longer works, because vfs_hash_get() calls > vget(), which calls _vn_lock() and _vn_lock() now complains if the lock > type field of "flags" is 0. I came up with a really ugly workaround, by > setting the flags arg. to LK_EXCLOTHER for vfs_hash_get() and then > providing my own VOP_LOCK1() which just VI_UNLOCK()s and returns 0 for > this case (doing the same as vop_stdlock() for other cases). Yuck!! >=20 > Is it possible to re-enable the case of _vn_lock() getting a locktype > field =3D=3D 0 (or defining one that says "just return 0 unless VI_DOOMED= "), > so I don't need the dirty hack? I do not quite understand what you really need there. The non-locked vnode may be reclaimed at any moment, so the check for !VI_DOOMED returns no useful information. --qnuS/wU1MXEWeKjo Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkiYEB0ACgkQC3+MBN1Mb4gt+gCfSgADScqDKFM/6MZ+P3odCjXZ l6QAoL9x78alOWSpFGCzB+CT70FB2JAM =x5zz -----END PGP SIGNATURE----- --qnuS/wU1MXEWeKjo--