From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jean-Pol.Guillement@math.univ-nantes.fr (Jean-Pol Guillement) Newsgroups: gmane.os.tru64.managers Subject: [SUMMARY] lockf and nfs files Date: Mon, 10 Nov 2003 15:51:17 +0100 (MET) Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <200311101451.PAA22580@lebesgue.math.univ-nantes.fr> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1068475916 15626 80.91.224.253 (10 Nov 2003 14:51:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2003 14:51:56 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Mon Nov 10 15:51:53 2003 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1AJDOT-0007P2-00 for ; Mon, 10 Nov 2003 15:51:53 +0100 Original-Received: (qmail 30676 invoked by uid 5); 10 Nov 2003 14:51:43 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 30661 invoked by uid 49493); 10 Nov 2003 14:51:43 -0000 Original-Received: from Jean-Pol.Guillement@math.univ-nantes.fr by sws1 by uid 49491 with qmail-scanner-1.16 (iscan: v3.1/v5.600-1011/622/49252. clamscan: 20030605. spamassassin: 2.55. Clear:SA:0(-5.1/5.0):. Processed in 0.742883 secs); 10 Nov 2003 14:51:43 -0000 Original-Received: from unknown (HELO emroute3.ornl.gov) (160.91.4.110) by 0 with SMTP; 10 Nov 2003 14:51:42 -0000 Original-Received: from emroute3.ornl.gov (localhost [127.0.0.1]) by emroute3.ornl.gov (PMDF V6.2-X17 #30669) with ESMTP id <0HO500LGB59NK8@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Mon, 10 Nov 2003 09:51:42 -0500 (EST) Original-Received: from lebesgue.math.univ-nantes.fr (lebesgue.math.sciences.univ-nantes.fr [193.52.98.8]) by emroute3.ornl.gov (PMDF V6.2-X17 #30669) with ESMTP id <0HO500LKR59HSY@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Mon, 10 Nov 2003 09:51:19 -0500 (EST) Original-Received: from (guilleme@localhost) by lebesgue.math.univ-nantes.fr (8.9.3/jtpda-5.3.3) id PAA22580 for tru64-unix-managers@ornl.gov; Mon, 10 Nov 2003 15:51:17 +0100 (MET) Original-To: tru64-unix-managers@ornl.gov Xref: main.gmane.org gmane.os.tru64.managers:5771 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:5771 Thanks to Fred.van.Kempen Fred.van.Kempen@microwalt.nl Dr Thomas.Blinn tpb@doctor.zk3.dec.com Paolo Lucente pl@ba.cnr.it who point me looking for rpc.lockd. Paolo Lucente also indicates http://nfs.sourceforge.net where I find the following solution. I have successfully experimented the "no_auth_nlm" export option. Many thanks, Jean-Pol Guillement --------------------------------------------------------------------------- (Ref http://nfs.sourceforge.net/#section_e) E. Using Linux NFS with alternate platforms E1. I use a Tru64 Unix 4.x or SunOS 4.1.x client. NFS File locking does not seem to work unless I give all users permissions on the file. A. The default specifications for NFS versions 2 and 3 allow any user to lock a file regardless whether that user has permission to access the file. The writers of the Linux NFS server regarded this behavior as insecure, and chose to only allow users who have access to a file to be able to lock it. However, older SunOS and Tru64 clients take advantage of the NFS specification by making all NFS file lock requests with the credentials of the daemon. This means that if the daemon does not have access to the files, the server will refuse to lock them. Solution: The export option "no_auth_nlm" is designed to alleviate this problem. Set it on any directories you wish to export to these clients. This will disable the authorization check on file lock requests. The option is expected to first be available in standard kernels 2.2.16 and nfs-utils 0.1.7, however they are currently available from the dhiggen kernel patches. --------------------------------------------------------------------------- The original post: > Dear managers, > > Can somebody explain me the behavior of the lockf function > on a Tru64, 4.0F, Alpha-server 1000A with NFS mounted files ? > > The following is a part of a program named testlock: > > ... > if ((fd=open(atester,O_WRONLY)) < 0) { > printf("impossible ouvrir %s.\n",atester); > exit(1); > } > t=lockf(fd,F_TEST,0); > if (t) { > printf("%s est locke',\nt=%d,errno = %d\n", > atester,t,errno); > printf("EBADF=%d,EACCES=%d,EAGAIN=%d,EDEADLK=%d\n\ > EINTR=%d,EINVAL=%d,EOPNOTSUPP=%d\n", > EBADF,EACCES,EAGAIN,EDEADLK,EINTR,EINVAL, > EOPNOTSUPP); > } else { > printf("%s pas locke'.\n",atester); > } > ... > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > test 1: > touch /tmp/e; chmod 600 /tmp/e; testlock -> not locked > (and the same on any not nfs mounted file). > > test 2: > /usr/users/namath is an nfs mounted directory from a linux box > by the following fstab (lebesgue) entry > /usr/users/namath@condorcet /usr/users/namath nfs > rw,bg,rsize=8192,wsize=8192,hard,intr,nfsvers=3 0 0 > and the exports line on the linux system (condorcet) > /usr/users/namath lebesgue(rw,no_root_squash) > > cd /usr/users/namath/myhome > touch e; chmod 600 e; testlock -> locked (errno=EACCES) > chmod 640 e; testlock -> locked (errno=EACCES) > chmod 644 e; testlock -> not locked > > test 3: > On an other linux box, on the same nfs mounted directory, > testlock gives always not locked.