From owner-freebsd-arch@FreeBSD.ORG Sun Apr 5 22:45:02 2009 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 34350106566B for ; Sun, 5 Apr 2009 22:45:02 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from skerryvore.cs.uoguelph.ca (skerryvore.cs.uoguelph.ca [131.104.94.204]) by mx1.freebsd.org (Postfix) with ESMTP id CF4188FC17 for ; Sun, 5 Apr 2009 22:45:01 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by skerryvore.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id n35MJd4M007699; Sun, 5 Apr 2009 18:19:39 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n35MPkJ07401; Sun, 5 Apr 2009 18:25:46 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Sun, 5 Apr 2009 18:25:46 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: zachary.loafman@isilon.com In-Reply-To: <20090405201048.GB6319@isilon.com> Message-ID: References: <20080412021209.W43186@desktop> <20090405201048.GB6319@isilon.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.204 Cc: arch@FreeBSD.org, Robert Watson 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, 05 Apr 2009 22:45:02 -0000 On Sun, 5 Apr 2009, zachary.loafman@isilon.com wrote: > > I haven't had a chance to dig into the code, but can you explain how the > v4 server is granting delegations without something like VOP_LEASE? This > was actually a conversation I was going to prep for prior to BSDcan. We > already have a cluster-coherent oplock mechanism for CIFS, and we were > planning on trying to hook that in with v4 delegations, but our FS very > much needs VOP calls to accomplish things like delegations. We can't use > a local lease manager. > Good question. At the moment my code simply assumes that nothing else in FreeBSD is doing Open/Share locks and my server just tracks them itself and, if enabled, issues delegations to clients so they can do them locally. If other things, like a CIFS server, are going to be doing them as well, I think there would need to be some sort of "Windows-like lock manager" that both/all services share. I don't know if it should live below the VFS layer (it's not a file system, but a lock manager). It almost seems like it needs its own kernel API that the varous servers use. (I'll admit, since POSIX clients just always Open/Deny_none, which means essentially "no open lock", I haven't much worried about it. There is only one Windows nfsv4 client out there and I don't know if they ever do Open/Deny other than none.) Obviously, if anything else in FreeBSD is going to be handling Open Shares, that isn't sufficient. (For those not familiar with them, Open Shares are a Windowsism where Open write/Deny write opens a file for writing, but doesn't allow anyone else to open it for writing until it is closed. I'm not a Windoze guy, so I probably didn't get that quite right, but it gives you some idea of what is being talked about. A Delegation allows a client to do the Open Shares and byte range locking locally, without talking to the server. The delegation is recalled when a conflicting Open or byte range lock shows up from another client (or something else locally on the server).) The only thing my server code currently does is provide a function that can be called to recall a delegation. It currently only gets called before a local VOP_RENAME() in my code, but should also be called before local VOP_OPEN() and VOP_REMOVE(). However, this isn't sufficient if anything other than my server is issuing Open Share locks. It's an area that definitely needs some thought. (Then, there's mandatory byte range locking. Lets not even talk about that, for now:-) > Like I said, I need to look at code; it's very likely the existing > VOP_LEASE isn't right for us, anyways. > I don't think that VOP_LEASE() would be appropriate for this, since it all happens at the time of Open. (A call before VOP_RENAME() is necessary, since the nfsv4 Open uses a directory filehandle + component name and won't work after a file is renamed, since the client only knows the old name. A call before VOP_REMOVE() would be nice, so that a client doesn't allow an Open of a file already removed. However, it'll get an ESTALE shortly after opening it, anyhow.) Long winded, but hopefully not too confused, rick