Bug 7874 - Oplocks granted only for the file owner
Summary: Oplocks granted only for the file owner
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.5.6
Hardware: x64 Windows 7
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
Depends on:
Reported: 2010-12-20 02:05 UTC by Georg Weickelt
Modified: 2011-01-04 08:50 UTC (History)
0 users

See Also:

network-trace opening files (66.73 KB, application/octet-stream)
2011-01-03 03:23 UTC, Georg Weickelt
no flags Details
level10 logfiles (184.48 KB, application/zip)
2011-01-04 07:20 UTC, Georg Weickelt
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Georg Weickelt 2010-12-20 02:05:46 UTC
Some users are faster than other users, I think because of caching the files on the client.
If they  the owner of the files, smbstatus shows me:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
14955        1000       DENY_NONE  0x2019f     RDWR       EXCLUSIVE+BATCH  /daten/public   CARD80/DHD-ORT2/ProData/DOM00105.MDX   Wed Dec  1 10:09:02 2010

If the don't own the file:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
5582         1002       DENY_NONE  0x2019f     RDWR       NONE             /daten/public   CARD80/DHD-ORT2/ProData/DOM00105.MDX   Wed Dec  1 10:12:06 2010

Clients are Windows 7 Prof. All connected to Samba 3.5.6-13.1-2472-SUSE-SL11.3-x86_64

Samba is acting as a domain-master.
This is a part of smb.conf:

 workgroup = Firma
 map to guest = Bad User
 passdb backend = tdbsam:/etc/samba/passdb.tdb
 time server = Yes
 printcap name = cups
 add machine script = /usr/sbin/useradd -d /var/lib/nobody -g 100 -s /bin/false -M %u
 logon script = netlogon.cmd
 logon path = \\%L\profiles\.msprofile
 logon drive = h:
 logon home = \\%L\%U\.9xprofile
 domain logons = Yes
 os level = 65
 preferred master = Yes
 domain master = Yes
 wins support = Yes
 ldap ssl = no
 cups options = raw

 comment = Datenverzeichnis
 path = /daten/public
 read only = No
 create mask = 0770
 directory mask = 0770

The path /daten/public is located on a ext3 filesystem, mounted with acl,user_xattr. The same on ext4 filesystem.

Thanks for reading
Comment 1 Volker Lendecke 2010-12-20 07:21:29 UTC

It is highly unlikely that this behaviour is a bug in Samba. Oplocks will be granted for the first opener asking for it. They will be broken once a second opener with appropriate permissions comes in. This second open can easily be the same application on the same client, MS Excel for example tends to break its own oplocks in many situations. It might be possible that your application behaves differently in this respect depending on whether it is opening the file as owner or not.

To nail that exactly, we would need a network trace comparing the app storing its files on Samba with storing the files on Windows.

I'm rejecting this bug as WORKSFORME. I've seen this really many times, and every time so far it was the application's fault.

Comment 2 Georg Weickelt 2011-01-03 03:23:11 UTC
Created attachment 6179 [details]
network-trace opening files

This are network-traces:
I opened two pdf-files with pdf-x-change-viewer. One with me as owner the other with an other owner on the samba-share
In the second file the same on an windows- share.
Comment 3 Georg Weickelt 2011-01-04 06:14:36 UTC
I can see this problem with different applications- for instance with Adobe-Reader or  Pdf-X-Change-Viewer.
We have a NAS-box without this problem.
Im far from an expert (an bad in english)- if other informations needed, I try to bring them.
Comment 4 Volker Lendecke 2011-01-04 07:03:09 UTC
Ok, assuming the Test-not-owner.pdf was not open by another client, it seems that there is really a problem. I need debug level 10 logs of that failure. Please for the test set "debug level = 10" and "max log size = 0".

With best regards,

Comment 5 Georg Weickelt 2011-01-04 07:20:57 UTC
Created attachment 6180 [details]
level10 logfiles

I did the same things as in the network-traces: opening two files. One with me as owner and the other as non-owner.
Comment 6 Volker Lendecke 2011-01-04 07:28:02 UTC
Thanks for the logs. It's a kernel interaction:

[2011/01/04 14:11:33.583037,  3] smbd/oplock_linux.c:120(linux_set_kernel_oplock)
  linux_set_kernel_oplock: Refused oplock on file Service/Test_not_owner.pdf, fd = 32, file_id = 816:16401e:0. (Keine Berechtigung)

If your Samba server is *just* a Samba server, if it does not also export the files via NFS, apache or other local processes, you might want to try setting

kernel oplocks = no

If you also have NFS or apache running, this is not really safe.

I'm closing this again as WORKSFORME. Please re-open if the "kernel oplocks = no" does not work for you.

Comment 7 Volker Lendecke 2011-01-04 07:28:27 UTC
Ooops, "WONTFIX", but it does not really matter.. :-)
Comment 8 Georg Weickelt 2011-01-04 08:50:39 UTC
 It works. Thank you!