[Samba] Issues with FLOCK on NFS Share

Georg.Biberger at partner.bmw.de Georg.Biberger at partner.bmw.de
Wed Jul 1 09:37:19 UTC 2020

       security = ADS
       workgroup = MUC
       realm = europe.bmw.corp
       netbios name = EDAINT
       netbios aliases = edaint.muc
       log file = /lfs/EDA/DATA/SOFTWARE/samba/var/log/samba/%m.log
       log level = 10
       # Default ID mapping configuration for local BUILTIN accounts
       # and groups on a domain member. The default (*) domain:
       # - must not overlap with any domain ID mapping configuration!
       # - must use a read-write-enabled back end, such as tdb.
       # - Adding just this is not enough
       # - You must set a DOMAIN backend configuration, see below
       idmap config * : backend = tdb
       idmap config * : range = 79846-100000
       idmap config MUC : backend = rid
 #      idmap config MUC : range = 79846-500000000
       template shell = /bin/bash
       template homedir = /home/%U
       winbind use default domain = true
       winbind offline logon = false
       winbind nss info = rfc2307
       winbind enum users = no
       winbind enum groups = no
       server string = EDA_Archiv_Integration
       username map=/lfs/EDA/DATA/SOFTWARE/samba/etc/usermap
       follow symlinks = yes
       wide links = yes
       unix extensions = no 
       unix charset = UTF-8
       kerberos method = secrets and keytab

    comment = EDA Archive Test
    directory = /lfs/EDA/DATA/SHARES/test/%U
    browseable = no
    writable = yes
    directory mask = 0700
    create mask = 0600
    force user = qqeda11
    force group = eda1
    kernel share modes = no

> 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);

To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

More information about the samba mailing list