From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Allison Subject: Re: [PATCH] locks: breaking read lease should not block read open Date: Wed, 20 Jul 2011 17:15:42 -0700 Message-ID: <20110721001542.GA15644@samba2> References: <20110609231606.GB22215@fieldses.org> <20110610134859.GA27837@fieldses.org> <20110721000758.GD27871@fieldses.org> Reply-To: Jeremy Allison Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, Volker Lendecke , samba-technical@lists.samba.org, Casey Bodley To: "J. Bruce Fields" Return-path: Content-Disposition: inline In-Reply-To: <20110721000758.GD27871@fieldses.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: samba-technical-bounces@lists.samba.org Errors-To: samba-technical-bounces@lists.samba.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Jul 20, 2011 at 08:07:58PM -0400, J. Bruce Fields wrote: > On Fri, Jun 10, 2011 at 09:48:59AM -0400, J. Bruce Fields wrote: > > On Fri, Jun 10, 2011 at 09:56:49AM +0200, Volker Lendecke wrote: > > > Without having looked too deeply, just let me point out that > > > Samba here has a plain flaw. Early Linux Kernel versions > > > that we programmed against did not properly support read > > > only leases, so we did not implement that initially. If I > > > remember correctly we never got around to finally do it once > > > it became available. Eventually we will probably, as read > > > only leases are a pretty important feature to present to > > > CIFS clients. > > > > Thanks, I didn't know that. (Or I did, and I forgot.) > > > > When you *do* implement that, is there any chance you'd have this need > > to be able to downgrade to a read lease in the case of a conflict? > > So it's a question about the protocols samba implements: > > - Do they allow an atomic downgrade from an exclusive to a > shared oplock? (Or to a level 2 oplock, or whatever the right > term is). Yes. Exclusive can go to level 2 - in fact that's the default downgrade we do (unless an smb.conf option explicity denies it). > - If so, can that happen as a response to a conflicting open? > (So, if you're holding an exclusive oplock, and a conflicting > open comes in, can the server-to-client break message say "now > you're getting a shared oplock instead"? Or is the client > left without any oplock until it requests a new one?) Yes, this can happen. In SMB, we only break to no lease when a write request comes in on a exclusive or level2 oplock (read-lease) handle. Jeremy.