public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK)
@ 2002-03-07 17:06 Alex Riesen
       [not found] ` <3C87AFB9.3000008@vitalstream.com>
  2002-03-07 19:32 ` Trond Myklebust
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Riesen @ 2002-03-07 17:06 UTC (permalink / raw)
  To: lkml

Hi, all

i'm trying to lock a file using advisory locks.
The file is on the filesystem exported by a linux machine
(RH 6.2, 2.4.2-SMP). The filesystem is mounted on HP-UX B.11.00
(HP-UX host1 B.11.00 A 9000/785 2011306912 two-user license).
Right now i cannot try this with the newer kernels.

The following simple program fails with ENOLCK.

#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>

int main(int c, char **v)
{
    for (++v, --c; c--; ++v) {
        struct flock lck = {F_RDLCK, SEEK_SET, 0, 0}; /* whole file */
        int fd = open(*v, O_RDONLY);
        if ( fd < 0 )
            fprintf(stderr, "%s: %s\n", *v, strerror(errno));
        else {
            if ( fcntl(fd, F_SETLK, &lck) < 0 )
                fprintf(stderr, "%s[%d]: %s\n", *v, lck.l_pid, strerror(errno));
            else
                printf("%s..ok\n", *v);
	    close(fd);
        }
    }
    return 0;
}

The typical output is:

/etc/passwd..ok
/net/sun-host/file1..ok
/net/aix-host/file1..ok
/net/linux-2_4_2-host/file1[0]: No locks available

The "[0]" is lck.l_pid from the example above.

HP's manpage have 3! explanations:

           [ENOLCK]       cmd is F_SETLK or F_SETLKW, the type of lock is a
                          read or write lock, and no more file-locking
                          headers are available (too many files have
                          segments locked), or no more record locks are
                          available (too many file segments locked).

           [ENOLCK]       cmd is F_SETLK or F_SETLKW, the type of lock
                          (l_type) is a read lock (F_RDLCK) or write lock
                          (F_WRLCK) and the file is an NFS file with access
                          bits set for enforcement mode.

           [ENOLCK]       cmd is F_GETLK, F_SETLK, or F_SETLKW, the file is
                          an NFS file, and a system error occurred on the
                          remote node.


My apologies if someone find the question inappropiate with the topic.
And thanks in advance for any help.


-alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK)
       [not found] ` <3C87AFB9.3000008@vitalstream.com>
@ 2002-03-07 18:47   ` Alex Riesen
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Riesen @ 2002-03-07 18:47 UTC (permalink / raw)
  To: Rick Stevens; +Cc: linux-kernel

Yes, the lockd is running (kernel lockd).
Besides works from sun to linux (running the program on a sun host show
positive results).


On Thu, Mar 07, 2002 at 10:21:45AM -0800, Rick Stevens wrote:
> Alex Riesen wrote:
> 
> >Hi, all
> >
> >i'm trying to lock a file using advisory locks.
> >The file is on the filesystem exported by a linux machine
> >(RH 6.2, 2.4.2-SMP). The filesystem is mounted on HP-UX B.11.00
> >(HP-UX host1 B.11.00 A 9000/785 2011306912 two-user license).
> >Right now i cannot try this with the newer kernels.
> 
> 
> Is the Linux server running lockd?  I can't recall if RH6.2 has
> that or not.  There are other problems with older RH releases.
> For example, RH6.2 doesn't support NFS V3, hence no bigfile support
> over NFS.
> 
> You really should upgrade to RH7.2 and many of your problems will
> go away.
> 
> 
> >The following simple program fails with ENOLCK.
> >
> >#define _GNU_SOURCE
> >#include <unistd.h>
> >#include <stdio.h>
> >#include <fcntl.h>
> >#include <string.h>
> >#include <errno.h>
> >
> >int main(int c, char **v)
> >{
> >    for (++v, --c; c--; ++v) {
> >        struct flock lck = {F_RDLCK, SEEK_SET, 0, 0}; /* whole file */
> >        int fd = open(*v, O_RDONLY);
> >        if ( fd < 0 )
> >            fprintf(stderr, "%s: %s\n", *v, strerror(errno));
> >        else {
> >            if ( fcntl(fd, F_SETLK, &lck) < 0 )
> >                fprintf(stderr, "%s[%d]: %s\n", *v, lck.l_pid, strerror(errno));
> >            else
> >                printf("%s..ok\n", *v);
> >	    close(fd);
> >        }
> >    }
> >    return 0;
> >}
> >
> >The typical output is:
> >
> >/etc/passwd..ok
> >/net/sun-host/file1..ok
> >/net/aix-host/file1..ok
> >/net/linux-2_4_2-host/file1[0]: No locks available
> >
> >The "[0]" is lck.l_pid from the example above.
> >
> >HP's manpage have 3! explanations:
> >
> >           [ENOLCK]       cmd is F_SETLK or F_SETLKW, the type of lock is a
> >                          read or write lock, and no more file-locking
> >                          headers are available (too many files have
> >                          segments locked), or no more record locks are
> >                          available (too many file segments locked).
> >
> >           [ENOLCK]       cmd is F_SETLK or F_SETLKW, the type of lock
> >                          (l_type) is a read lock (F_RDLCK) or write lock
> >                          (F_WRLCK) and the file is an NFS file with access
> >                          bits set for enforcement mode.
> >
> >           [ENOLCK]       cmd is F_GETLK, F_SETLK, or F_SETLKW, the file is
> >                          an NFS file, and a system error occurred on the
> >                          remote node.
> >
> >
> >My apologies if someone find the question inappropiate with the topic.
> >And thanks in advance for any help.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK)
  2002-03-07 17:06 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK) Alex Riesen
       [not found] ` <3C87AFB9.3000008@vitalstream.com>
@ 2002-03-07 19:32 ` Trond Myklebust
  2002-03-08  7:16   ` Alex Riesen
  1 sibling, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2002-03-07 19:32 UTC (permalink / raw)
  To: Alexander.Riesen; +Cc: linux-kernel

>>>>> " " == Alex Riesen <Alexander.Riesen@synopsys.com> writes:

     > Hi, all i'm trying to lock a file using advisory locks.  The
     > file is on the filesystem exported by a linux machine (RH 6.2,
     > 2.4.2-SMP). The filesystem is mounted on HP-UX B.11.00 (HP-UX
     > host1 B.11.00 A 9000/785 2011306912 two-user license).  Right
     > now i cannot try this with the newer kernels.

     > The following simple program fails with ENOLCK.

HP clients require the 'insecure_locks' option to be set in the RedHat
server's /etc/exports file.

Cheers,
   Trond

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK)
  2002-03-07 19:32 ` Trond Myklebust
@ 2002-03-08  7:16   ` Alex Riesen
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Riesen @ 2002-03-08  7:16 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: lkml

On Thu, Mar 07, 2002 at 08:32:39PM +0100, Trond Myklebust wrote:
> >>>>> " " == Alex Riesen <Alexander.Riesen@synopsys.com> writes:
> 
>      > Hi, all i'm trying to lock a file using advisory locks.  The
>      > file is on the filesystem exported by a linux machine (RH 6.2,
>      > 2.4.2-SMP). The filesystem is mounted on HP-UX B.11.00 (HP-UX
>      > host1 B.11.00 A 9000/785 2011306912 two-user license).  Right
>      > now i cannot try this with the newer kernels.
> 
>      > The following simple program fails with ENOLCK.
> 
> HP clients require the 'insecure_locks' option to be set in the RedHat
> server's /etc/exports file.
> 

Thank you, we are trying this.
-alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-08  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-07 17:06 2.4.2-SMP: problem locking nfs files mounted on HPUX (ENOLCK) Alex Riesen
     [not found] ` <3C87AFB9.3000008@vitalstream.com>
2002-03-07 18:47   ` Alex Riesen
2002-03-07 19:32 ` Trond Myklebust
2002-03-08  7:16   ` Alex Riesen

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