Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2014 17:51:40 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        rmacklem@uoguelph.ca
Cc:        freebsd-fs@FreeBSD.org, ivoras@FreeBSD.org
Subject:   Re: lockf(1) and NFS
Message-ID:  <201408300051.s7U0peLr073400@gw.catspoiler.org>
In-Reply-To: <1912666252.30566061.1409356477461.JavaMail.root@uoguelph.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29 Aug, Rick Macklem wrote:
> Ivan Voras wrote:
>> Hi,
>> 
>> I had some fun troubleshooting NFS locking and among other things,
>> found
>> that lockf(1) doesn't really work on NFSv4 mounts. Googling around
>> (so
>> correct me if I'm wrong), it looks like this is because NFS quietly
>> translates the old-style locks into POSIX range locks, and those
>> cannot
>> be acquired exclusively if the file is opened read-only.
>> 
> Yes, the NFSv4 protocol only supports POSIX byte range locks.
> The only alternative to translating flock(2) locks to POSIX locks is
> to not support flock(2) locks at all.

As I recall, on SunOS, flock(2) locks were local to the machine.  Looks
like that was changed later on ...

    "Locks obtained through the flock() mechanism under SunOS 4.1
     were known only within the system on which they were placed.
     This is no longer true."

<http://www.manpages.info/sunos/flock.3.html>;

That was actually a feature because you could use flock() to coordinate
between local processes, while avoiding any NFS lock manager bugs, even
on diskless machines.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408300051.s7U0peLr073400>