Date: Sat, 30 Aug 2014 07:46:59 -0400 (EDT) From: Rick Macklem <rmacklem@uoguelph.ca> To: Don Lewis <truckman@FreeBSD.org> Cc: freebsd-fs@FreeBSD.org, ivoras@FreeBSD.org Subject: Re: lockf(1) and NFS Message-ID: <1588968883.30624902.1409399219119.JavaMail.root@uoguelph.ca> In-Reply-To: <201408300051.s7U0peLr073400@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Don Lewis wrote: > 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. > > > Doing locking locally within the client is still possible with the "nolockd" option. However, when this mount option is used all file locking, including POSIX byte range locks, are done locally. Linux has a similar mount option (called "nolock" I think?), but I don't know if Solaris has any mount option. I'm pretty sure Ivan knows about this, so I suspect he needs lockf(1) to work across multiple clients for his app., but don't know for sure? rick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1588968883.30624902.1409399219119.JavaMail.root>