[Samba] Issues with FLOCK on NFS Share

Georg.Biberger at partner.bmw.de Georg.Biberger at partner.bmw.de
Wed Jul 1 08:26:41 UTC 2020

> Howdy!
> Am 6/30/20 um 2:37 PM schrieb Georg.Biberger--- via samba:
>> We are using Samba 4.10.16 as a readonly file server on a linux box with SLES 12. All is working fine with our NAS NFS Shares. We are now trying to integrate new NFS Shares from an archive provider. We have some problems with samba not responding, when accessing files on these archive NFS shares.
>> We have done some Samba-Debugging and found out, that the call to flock in source3/lib/system.c (kernel_flock) do not return and is blocking samba!
> kernel oplocks = no

>Only problem with that, it is the default setting :-(

> Can we see your smb.conf ?

I have now set 
kernel share modes = no
which solves this issue!
Attached my smb.conf.

I was wondering if the kernel_flock function in source3/lib/system.c is correct implemented. E.g. when the function is called with parameter share_mode set to FILE_SHARE_READ|FILE_SHARE_WRITE, then the function flock is not be called.
void kernel_flock(int fd, uint32_t share_mode, uint32_t access_mask)
        int kernel_mode = 0;
        if (share_mode == FILE_SHARE_WRITE) {
                kernel_mode = LOCK_MAND|LOCK_WRITE;
        } else if (share_mode == FILE_SHARE_READ) {
                kernel_mode = LOCK_MAND|LOCK_READ;
        } else if (share_mode == FILE_SHARE_NONE) {
                kernel_mode = LOCK_MAND;
        if (kernel_mode) {
                flock(fd, kernel_mode);


More information about the samba mailing list