[Samba] oplocks, kernel oplocks, kernel share modes, .. - how it all works?

Jeremy Allison jra at samba.org
Tue Jan 24 21:29:21 UTC 2023


On Tue, Jan 24, 2023 at 10:19:58PM +0100, Ralph Boehme wrote:
>On 1/24/23 22:12, Jeremy Allison wrote:
>>Oh, very interesting. Something is wrong in our code then, as Ralph
>>already mentioned we have:
>>
>>         capabilities = 0;
>>         if (lp_host_msdfs()) {
>>                 capabilities |= SMB2_CAP_DFS;
>>         }
>>
>>         if (protocol >= PROTOCOL_SMB2_10 &&
>>             lp_smb2_leases() &&
>>             lp_oplocks(GLOBAL_SECTION_SNUM) &&
>>             !lp_kernel_oplocks(GLOBAL_SECTION_SNUM))
>>         {
>>                 capabilities |= SMB2_CAP_LEASING;
>>         }
>>
>>so setting "kernel oplocks = yes" should prevent SMB2_CAP_LEASING
>>being returned to the client. A wireshark trace when you remove
>>the "smb2 leases = no" line would be good to look at.
>
>oh! That is the only place where we treat kernel oplocks as a global 
>option. The docs and the rest of the code allow this as a per share 
>option. Looks like we have a problem here.
>
>@Michael: move the kernel oplocks setting to the global section, then 
>things may start to work as expected.

Oh, great catch Ralph ! Once we've told the client we will
handle leases we don't have a way to map the requested lease
type to an oplock type if "kernel oplocks = yes" is set.



More information about the samba mailing list