From owner-freebsd-fs@FreeBSD.ORG Mon Aug 4 20:53:46 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 2CE621065679 for ; Mon, 4 Aug 2008 20:53:46 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from moe.cs.uoguelph.ca (moe.cs.uoguelph.ca [131.104.94.198]) by mx1.freebsd.org (Postfix) with ESMTP id C93C98FC27 for ; Mon, 4 Aug 2008 20:53:45 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by moe.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id m74KriEN028491 for ; Mon, 4 Aug 2008 16:53:44 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id m74L4wP04895 for ; Mon, 4 Aug 2008 17:04:58 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Mon, 4 Aug 2008 17:04:58 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: freebsd-fs@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.198 Subject: 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: Mon, 04 Aug 2008 20:53:46 -0000 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.) For FreeBSD7, all I did was call vfs_hash_get() with flags == 0 and it gave me what I wanted (the vnode for the file handle with a reference count, but no lock). 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!! Is it possible to re-enable the case of _vn_lock() getting a locktype field == 0 (or defining one that says "just return 0 unless VI_DOOMED"), so I don't need the dirty hack? Have a good week, rick