[Samba] performance problem with 3.2.8: unbuffered reads for some users

Alexander 'Leo' Bergolth leo at strike.wu-wien.ac.at
Wed Mar 4 17:21:27 GMT 2009

On 03/04/2009 04:16 PM, Volker Lendecke wrote:
> On Wed, Mar 04, 2009 at 03:58:20PM +0100, Alexander 'Leo' Bergolth wrote:
>> Here's the log for the unbuffered session:
>>   http://leo.kloburg.at/tmp/samba/log.gf2.gz
> That's the key:
> [2009/03/04 15:51:48,  3] smbd/oplock_linux.c:linux_set_kernel_oplock(138)
>   linux_set_kernel_oplock: Refused oplock on file Firefox/LICENSE, fd = 28, file_id = fd03:157b181.  (Permission denied)
> Do you have something like SELinux or so? Or do you share
> the files via NFS and some NFS client has the files open?

Hmm. Thanks for tracking this down.
Please help me uderstand why this fails...

Are there any corresponding recent samba or kernel changes?
It fails on Fedora 10 with kernel-PAE- and
samba-3.2.8-0.26.fc10.i386 while it did work with kernel

SELinux is disabled, NFS is not in use.

# selinuxenabled && echo yes || echo no
# /etc/init.d/nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

According to the source (oplock_linux.c), linux_setlease() does a
F_SETLEASE fcntl call. If that fails, it calls
set_effective_capability(LEASE_CAPABILITY) and tries the same call again.

The strace output of the corresponding part is:

19115 open("Firefox/LICENSE", O_RDONLY|O_LARGEFILE) = 28
19115 fcntl64(28, F_SETSIG, 0x23)       = 0
19115 fcntl64(28, 0x400 /* F_??? */, 0x1) = -1 EACCES (Permission denied)
19115 fcntl64(28, 0x400 /* F_??? */, 0x1) = -1 EACCES (Permission denied)
19115 fcntl64(12, F_SETLKW64, {type=F_UNLCK, whence=SEEK_SET,
start=22032, len=1}, 0xbfedbce4) = 0

According to the fcntl man-page, only privileged processes or processes
with the CAP_LEASE capability may do F_SETLEASE:

-------------------- 8< --------------------
Leases may only be taken out on regular files. An unprivileged process
may only take out a lease on a file whose UID (owner) matches the file
system UID of the process. A process with the CAP_LEASE
capability may take out leases on arbitrary files.
-------------------- 8< --------------------

The file isn't owned by the user that accesses it, so I guess the
CAP_LEASE capability should be necessary. But shouldn't strace show a
call to capset(2) between those two F_SETLEASE fcntl calls (0x400)?

e-mail   ::: Leo.Bergolth (at) wu-wien.ac.at
fax      ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria

More information about the samba mailing list