[linux-l] NFS file locking: es geht einfach nicht...

Jan Krüger jk at microgalaxy.net
Fr Apr 2 15:50:26 CEST 2004


Oswald Buddenhagen wrote:

>On Fri, Apr 02, 2004 at 02:42:11PM +0200, Steffen Dettmer wrote:
>  
>
>>Server macht NFS-Server und wella bekommt natürlich kein flock
>>via NFS, verdammt.
>>
>>    
>>
>vielleicht liegt es ja daran?
>
>FLOCK(2)                   Linux Programmer's Manual                  FLOCK(2)
>[...]
>NOTES
>       flock(2) does not lock files over NFS.  Use fcntl(2) instead: that does
>       work  over  NFS,  given  a  sufficiently  recent version of Linux and a
>       server which supports locking.
>
Ich habe im OpenBSD mailing-listen Archiv folgendes gefunden was hier
helfen könnte:

Luckily Linux has the "insecure_locks" option to use in the /etc/exports
file. Using this option enables OpenBSD or Tru64 to lock files when it
is used as a client.

Außerdem von linux-kernel bzw. arla-drinkers:
> The semantics of flock not locking on network file systems go back to

> SunOS and make some sense. flock() gives you a locking scheme that is
> local and fast, lockf/fcntl locks give you slow but networked NFS locks.

Indeed, this was the case in SunOS, but this is an excerpt from the
Solaris 2.5.1 man page for flock(2):

     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.

In the OpenBSD 2.3 man page for flock(2), network file locking is not
mentioned. This means that a network file system is not a special case
lock-wise.

Also: use OpenBSD for NFS-flock()-ing ;-)

oder halt fcntl()

Gruß
Jan




Mehr Informationen über die Mailingliste linux-l