tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* [SUMMARY] lockf and nfs files
@ 2003-11-10 14:51 Jean-Pol Guillement
  0 siblings, 0 replies; only message in thread
From: Jean-Pol Guillement @ 2003-11-10 14:51 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-10 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-10 14:51 [SUMMARY] lockf and nfs files Jean-Pol Guillement

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox