I have two shares, one with "kernel oplocks = Yes", and another one with "kernel oplocks = No". smb2 leases are disabled. When server establishes connection with the 1st share, smbd sets sconn->oplocks.kernel_ops in make_connection_snum(). Then, when samba opens file on a 2nd share, it may call set_file_oplock(oplock=0x4), but linux_set_kernel_oplock is not called, because kernel oplocks = No. But later downgrade_oplock() for the file on the 2nd share can be issued, that in turn will call downgrade_file_oplock(). Here downgrade_file_oplock() checks only if sconn->oplocks.kernel_ops is set, but not "kernel oplocks" flag, and calls linux_release_kernel_oplock, that returns EAGAIN: [2017/11/27 16:23:24.807595, 0, pid=4325, class=locking] ../source3/smbd/oplock_linux.c:184(linux_release_kernel_oplock) linux_release_kernel_oplock: Error when removing kernel oplock 0x4 on file /export/smbOnly:shared_text.txt, file_id = fd16:83:0, gen_id = 1750599511. Error was Resource temporarily unavailable This issue reminds https://bugzilla.samba.org/show_bug.cgi?id=11400, but now it is about downgrade_file_oplock and not release_file_oplock.
Created attachment 13876 [details] Raw (not git) patch for master. Can you check this patch and see if it fixes your problem ? It causes downgrade_file_oplock() to use the same logic as release_file_oplock().
Created attachment 13877 [details] Updated raw patch for master. Corrects the use_kernel logic in all functions in this file. Please test and let me know.
Ping ! Lev, can you let me know if this fix solved the problem ?
(In reply to Jeremy Allison from comment #3) Jeremy, sorry, I'm on vacation now, will be back only in a week. Lev.
OK, no problem. I'm also out over the holiday period. Let me know when you get a chance to test :-). Happy Holidays !
Hi Jeremy, Yes, I confirm, the patch fixes the issue, Thanks, -Lev.
Created attachment 13892 [details] Proposed git-am fix for master.
Created attachment 13893 [details] Identical fix for 4.7.next, 4.6.next cherry-picked from master.
Pushed to autobuild-v4-{7,6}-test.
Pushed to both branches. Closing out bug report. Thanks!