Samba and Linux OFD locks

Jeremy Allison jra at samba.org
Fri Feb 1 08:11:52 UTC 2019


On Thu, Jan 31, 2019 at 03:35:01PM +0100, Andreas Schneider wrote:
> On Wednesday, January 30, 2019 7:45:30 PM CET Andreas Schneider via samba-
> technical wrote:
> > Hello,
> > 
> > on newer Linux distributions with glibc >= 2.20 we have OFD file locks
> > available. Our autobuild hosts are too old!
> > 
> > However if your system supports OFD file locks the
> > samba3.vfs.fruit_netatalk.nt4 test is failing!
> 
> attached is a patchset which does some cleanup and disables OFD locks. They 
> are obviously not working. The code might need some fixes.

No, they're not working in the fruit tests. That doens't mean
they're not working generally.

> I've talked to Jeff Layton who implemented OFD locks. The follwing strace 
> line:
> 
> 3163  19:20:18.349723 fcntl(37</home/asn/workspace/projects/samba/st/nt4_dc/
> share/vfs_fruit_dir/locking_conflict.txt>, F_OFD_GETLK, {l_type=F_RDLCK, 
> l_whence=SEEK_SET, l_start=0, l_len=9223372036854775807, 
> l_pid=18446744073709551615}) = 0 <0.000003>
> 
> tells us that there is still a read lock on the file! The l_pid has this bogus 
> value because in principle if you had a file description shared across 
> processes, you can't really say which pid owns it.
> 
> Looking at the strace we seem to open and lock the file twice!
> 
> 3163  19:20:18.348328 fcntl(36</home/asn/workspace/projects/samba/st/nt4_dc/
> share/vfs_fruit_dir/locking_conflict.txt>, F_OFD_SETLK, {l_type=F_RDLCK, 
> l_whence=SEEK_SET, l_start=0, l_len=9223372036854775807}) = 0 <0.000004>
> 
> This line locks it and there is no release! Also we create a lock on file 
> descriptor 36 and 37. OFD locks are different from POSIX locks in that if you 
> set a lock on two different fds for the same file they'll conflict with one 
> another!

Yes, that's the whole point and the way the server code
expects it to work. That's why we have the upper layer
that checks the Windows semantics before mapping onto
the lower layer OFD semantics.

Don't just disable without undetstanding.

Let's figure out why the fruit tests aren't working
before doing anything drastic like disabling by
default.



More information about the samba-technical mailing list