From owner-freebsd-fs@FreeBSD.ORG Sat Aug 30 00:53:04 2014 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4482A31; Sat, 30 Aug 2014 00:53:04 +0000 (UTC) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E3011F1; Sat, 30 Aug 2014 00:53:04 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id s7U0peLr073400; Fri, 29 Aug 2014 17:51:44 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201408300051.s7U0peLr073400@gw.catspoiler.org> Date: Fri, 29 Aug 2014 17:51:40 -0700 (PDT) From: Don Lewis Subject: Re: lockf(1) and NFS To: rmacklem@uoguelph.ca In-Reply-To: <1912666252.30566061.1409356477461.JavaMail.root@uoguelph.ca> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: freebsd-fs@FreeBSD.org, ivoras@FreeBSD.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2014 00:53:05 -0000 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." 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.