From owner-freebsd-arch@FreeBSD.ORG Sun Apr 13 20:18:03 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38813106564A for ; Sun, 13 Apr 2008 20:18:03 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [64.81.247.49]) by mx1.freebsd.org (Postfix) with ESMTP id 185FC8FC26 for ; Sun, 13 Apr 2008 20:18:02 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (localhost.mckusick.com [127.0.0.1]) by chez.mckusick.com (8.13.8/8.13.8) with ESMTP id m3DKI4MG007310; Sun, 13 Apr 2008 13:18:04 -0700 (PDT) (envelope-from mckusick@chez.mckusick.com) Message-Id: <200804132018.m3DKI4MG007310@chez.mckusick.com> To: Jeff Roberson Date: Sun, 13 Apr 2008 13:18:04 -0700 From: Kirk McKusick Cc: arch@freebsd.org Subject: Re: VOP_LEASE X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Apr 2008 20:18:03 -0000 The explanation is correct that VOP_LEASE is present so that an NFS server is made aware when a file is used locally so that the server can take appropriate action on the leases that it has extended to its clients. Because VOP_LEASE is not under a lock, the race that Jeff points out is also valid. To be race-free, they would need to be protected by the vnode lock. Most instances of them are still protected by the vnode lock, though some key ones (like READ and WRITE) fell out of being protected when the vnode lock was pushed down so that it no longer protected f_offset updates. Using the pre- and post- hooks in the vnode operations would be an equally valid place to do the leasing call-back to the NFS (or other remote filesystem) server. As the VOP_LEASE calls were, at least at the time they were in use, correctly placed and indentified read or write access, it might be useful to figure out the appropriate set of pre- and post- hooks as part of their removal. Kirk McKusick