lockf and nfs files

From: Jean-Pol Guillement (Jean-Pol.Guillement@math.univ-nantes.fr)
Date: Thu Nov 06 2003 - 09:00:18 EST


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.

Thanks in advance,

Jean-Pol Guillement



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:43 EDT