[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stale lock files



Goswin von Brederlow <brederlo@informatik.uni-tuebingen.de> writes:

> Write the pid and host to the lock file. When you detect a lock and
> the lock is on the local host then check the pid is still valid. If
> not the lock is stale. If the lock is from a remote host there is
> little you can do but ask.

Why not use fcntl/lockf byte region locking on the entire file?  It
gets released as soon as the process terminates, so there are no
issues with stale locks, and it works over NFS.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: pgpuO3l6X8k1u.pgp
Description: PGP signature


Reply to: