Samba and Linux OFD locks

Jeremy Allison jra at samba.org
Fri Feb 1 08:07:21 UTC 2019


On Thu, Jan 31, 2019 at 09:49:02AM -0500, Jeff Layton wrote:
> On Wed, 2019-01-30 at 17:21 -0800, Jeremy Allison via samba-technical
> wrote:
> > On Wed, Jan 30, 2019 at 07:45:30PM +0100, Andreas Schneider 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!
> > > 
> > > The attached patch has some fixes and adds debug messages and shows a 
> > > workaround.
> > > 
> > > If you look where it fails, we want to unlock a file with fcntl and get:
> > > 
> > > 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>
> > 
> > l_len and l_pid look... strange here. I don't think they
> > can be correct.
> > 
> 
> l_pid is correct -- it's -1.

Ah, I thought it might be, but didn't do the 64-bit
math in my head to convert from int -> hex here, sorry :-).

> Because OFD locks aren't associated with a process, we can't reasonably
> report l_pid. The file description could be shared across processes, so
> we can't reliably say what pid "owns" it.
>
> fwiw: the -1 comes from BSD where flock and fcntl locks can conflict,
> and BSD always reports -1 for l_pid when the conflicting lock is a flock

Yes, I remember that from the design.



More information about the samba-technical mailing list