Bug 11400 - smbd tries to release not leased oplock
smbd tries to release not leased oplock
Status: RESOLVED FIXED
Product: Samba 4.0
Classification: Unclassified
Component: File services
4.0.25
All Linux
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-15 08:33 UTC by Lev
Modified: 2016-01-18 08:24 UTC (History)
3 users (show)

See Also:


Attachments
possible patch (1.04 KB, patch)
2016-01-04 22:14 UTC, Christian Ambach
no flags Details
Patch for 4.3.x and 4.2.x with cherry-pick information (1.27 KB, patch)
2016-01-06 19:41 UTC, Christian Ambach
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lev 2015-07-15 08:33:29 UTC
I have two shares, one with "kernel oplocks = Yes", and another one with "kernel oplocks = No".
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=0x2), but linux_set_kernel_oplock is not called, because kernel oplocks = No.
But when file is closed, release_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:

Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]: [2015/06/22 15:02:55.886428,  0, pid=3752, class=locking] ../source3/smbd/oplock_linux.c:184(linux_release_kernel_oplock)
Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]:   linux_release_kernel_oplock: Error when removing kernel oplock on file Automation/Phase 3/Reports/Aspire16/Collections/2014/01_January/140122 Aspire16 Collections.xls, file_id = 20fc15:1413b2d:0, gen_id = 2055499866. Error was Resource temporarily unavailable
Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]: [2015/06/22 15:02:55.902226,  0, pid=3752, class=locking] ../source3/smbd/oplock_linux.c:184(linux_release_kernel_oplock)
Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]:   linux_release_kernel_oplock: Error when removing kernel oplock on file Automation/Phase 3/Reports/Aspire16/Collections/2014/01_January/140123 Aspire16 Collections.xls, file_id = 20fc15:1413b2e:0, gen_id = 884879534. Error was Resource temporarily unavailable
Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]: [2015/06/22 15:02:55.918325,  0, pid=3752, class=locking] ../source3/smbd/oplock_linux.c:184(linux_release_kernel_oplock)
Jun 22 15:02:55 vsa-000004a5-vc-1 smbd[3752]:   linux_release_kernel_oplock: Error when removing kernel oplock on file Automation/Phase 3/Reports/Aspire16/Collections/2014/01_January/140127 Aspire16 Collections.xls, file_id = 20fc15:1413b2f:0, gen_id = 993100754. Error was Resource temporarily unavailable
Comment 1 Christian Ambach 2016-01-04 22:14:26 UTC
Created attachment 11756 [details]
possible patch

This patch might fix the problem. Can you give it a try?
Comment 2 Lev 2016-01-05 07:23:19 UTC
Yes, looks good.
-Lev.
Comment 3 Jeremy Allison 2016-01-06 04:50:44 UTC
Comment on attachment 11756 [details]
possible patch

LGTM. Pushed to master !

Jeremy.
Comment 4 Christian Ambach 2016-01-06 19:41:01 UTC
Created attachment 11759 [details]
Patch for 4.3.x and 4.2.x with cherry-pick information

Thx for the review.

Here is the patch with cherry pick information to get it into 4.3.x and 4.2.x
Comment 5 Jeremy Allison 2016-01-06 20:35:10 UTC
Comment on attachment 11759 [details]
Patch for 4.3.x and 4.2.x with cherry-pick information

LGTM.
Comment 6 Jeremy Allison 2016-01-06 20:35:37 UTC
Reassigning to Karolin for inclusion in 4.3.next, 4.2.next.
Comment 7 Karolin Seeger 2016-01-14 09:10:34 UTC
(In reply to Jeremy Allison from comment #6)
Pushed to autobuild-v4-[2|3]-test.
Comment 8 Karolin Seeger 2016-01-18 08:24:59 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to both branches.
Closing out bug report.

Thanks!