From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,ea0b89f611bff419 X-Google-Attributes: gidfa528,public From: Tony Verhulst Subject: Re: How to identify locking process Date: 2000/10/24 Message-ID: <39F5F152.A7FFD89A@zk3.dec.com>#1/1 X-Deja-AN: 685385271 Content-Transfer-Encoding: 7bit References: <8t4qi8$k99$1@infosun2.rus.uni-stuttgart.de> X-Accept-Language: nl, en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@mailint03.im.hou.compaq.com X-Trace: mailint03.im.hou.compaq.com 972419466 12496 16.140.128.246 (24 Oct 2000 20:31:06 GMT) Organization: UNIX Kernel Group Mime-Version: 1.0 NNTP-Posting-Date: 24 Oct 2000 20:31:06 GMT Newsgroups: comp.unix.tru64 Stefan Schwarzer wrote: > > We use an application (maple) that seems to rely on a (help) database > which it locks during use. Somehow, such a lock does not have been > properly removed maybe due to a crash, or a NFS locking problem or > some other reason. Now, whenever I use the application, it freezes on > me, probably waiting for the lock to become available. > > Can I find out which process owns a lock? > Is there any way to unlock the file (if I could find out which one it is) > without reboot? > Over NFS, can I trick the lockd's into loosing locks? Assuming you have the source and if the lock is a semaphore, you can set the SEM_UNDO flag when the lock is aquired so that when a process terminates the lock is guaranteed to be dropped: partdb->sops.sem_num = 0; partdb->sops.sem_op = -1; partdb->sops.sem_flg = SEM_UNDO; if (semop(partdb->sem_id, &partdb->sops, 1) == -1) perror("semop (lock)"); If you have no source, and again assuming semaphores, use ipcs(1) to get the current semaphores and then use ipcrm(1) to remove it. Tony V. Kernel Group