File Locking on NFS files

File Locking on NFS files

Post by Ron Baal » Sat, 19 Feb 1994 09:36:00



A colleague of mine is having trouble with his file locking code with
NFS files.  When two processes try to lock the same NSF file, they both
get hung up.  Are there any special tricks you have to do?  Any help is
appreciated.
     ___    _____     ___

    | | | |  __ \ /| | | |     Jet Propulsion Lab |
 ___| | | | |__) |/  | | |__   Galileo S-Band     | Failure is success if we
/___| | | |  ___/    | |/__ /| Pasadena, CA 91109 | learn from it.
|_____|/  |_|/       |_____|/                     |             Malcom Forbes
 
 
 

File Locking on NFS files

Post by justice e. cha » Tue, 22 Feb 1994 10:43:14


: A colleague of mine is having trouble with his file locking code with
: NFS files.  When two processes try to lock the same NSF file, they both
: get hung up.  Are there any special tricks you have to do?  Any help is
: appreciated.
:      ___    _____     ___

:     | | | |  __ \ /| | | |     Jet Propulsion Lab |
:  ___| | | | |__) |/  | | |__   Galileo S-Band     | Failure is success if we
: /___| | | |  ___/    | |/__ /| Pasadena, CA 91109 | learn from it.
: |_____|/  |_|/       |_____|/                     |             Malcom Forbes

--

        Is he using flock or lockf? Is he using non-blocking lock testing?

        Justice E. Chase         |      

        _____________________________________________________
        Crestar Bank thought my name was a title ...
                then they demoted me to Judge.      

 
 
 

File Locking on NFS files

Post by Ron Baal » Fri, 25 Feb 1994 04:55:00




>: A colleague of mine is having trouble with his file locking code with
>: NFS files.  When two processes try to lock the same NSF file, they both
>: get hung up.  Are there any special tricks you have to do?  Any help is
>: appreciated.
>    Is he using flock or lockf? Is he using non-blocking lock testing?

Neither.  He's using fcntl for the file locking.  He's also using
blocking locks with the fcntl calls.
     ___    ____      ___

    | | | |  __ \ /| | | |     Jet Propulsion Lab |
 ___| | | | |__) |/  | | |__   Galileo S-Band     | Failure is success if we
/___| | | |  ___/    | |/__ /| Pasadena, CA 91109 | learn from it.
|_____|/  |_|/       |_____|/                     |             Malcom Forbes
 
 
 

1. ksh hangs attempting to lock history file on NFS mounted file system

We have a bunch of Unixware users, mostly running 1.1.4, who are having
this problem (ksh hangs, investigation shows it is in the process of
trying to lock the history file)

I have offered them this workaround:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a ksh bug that causes ksh to hang when a user has multiple shell
processes trying to share a history file in a NFS mounted directory, e.g.
the user's home  directory.

Recommended fix: use this line in .profile:

    HISTFILE=/tmp/.history.$$; export HISTFILE

This causes a different history file to be created for each process.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I use this myself all the time and have never experienced the problem.
I prefer to have a separate history for each process, but some of our
users here really like to have one big history file shared by all
processes.

Is there a Unixware 1.1 patch for this?

--

Computing and Telecommunications Services       Unix System Administration Team
http://info.dr.att.com/~ambient/home.html       303-538-4821

Internet User #19075 of the Citizens Internet Empowerment Coalition
See http://www.cdt.org/ciec.

2. Dual Homed Box Problem

3. File Locking on NFS files

4. Ultimate Doom episode IV on Linux?

5. More mail file locking questions (lockf, NFS, /var/spool/mail/*.lock)

6. missing menu in kde3.1 rc3

7. nfs very slow, locking files across nfs ?

8. Ethernet to PPP routing problems

9. NFS File Locking

10. File Locking and NFS

11. NFS file locking

12. file locking over NFS

13. locking files over NFS