Latest leases patchset - getting there !

Jeremy Allison jra at
Tue Nov 18 09:34:55 MST 2014

On Tue, Nov 18, 2014 at 02:07:14PM +0100, Stefan (metze) Metzmacher wrote:
> >         }
> > +#if 0
> >         if ((num_read_oplocks == 1) && (fsp->oplock_type == LEASE_OPLOCK)) {
> >                 DEBUG(10, ("We're the only reader, don't break\n"));
> >                 return;
> >         }
> > +#endif
> This is just for performance, we'll still skip breaking
> our own lease within do_break_to_none().

Did change behavior though, so I don't thnk that's
right. Also the logic there is incorrect, as we
can have a LEASE_OPLOCK of type SMB_LEASE_NONE
and a LEVEL2 oplock from another smbd as well in
the share mode db for a file. That optimization
removes the break to none needed on write on the

> I think we need to use smb2_lease_equal() there instead of doing:
>                 if ((l->[0] == state->[0]) &&
>                     (l->[1] == state->[1])) {
>                         DEBUG(10, ("Don't break our own lease\n"));
>                         continue;
>                 }


> Why do we need the fsp at all, can't we hang the timeout on fsp->lease?

I'll take a look.

> I'm also wondering, if you should remember the exiration time in
> the 'breaking' field instead of just a bool.
> If the process trying to send the lease break to the client gets
> disconnected,
> we'll never downgrade when it times out and the lease is still valid
> over another connection.

Yeah, maybe later... I'm trying to finish all the
tests + lease logic first.

Let's get fancy later :-).

More information about the samba-technical mailing list