how to figure out which process is locking a file

how to figure out which process is locking a file

Post by song wan » Sat, 16 Oct 1999 04:00:00



hi,

I'm currently get a message saying a file is locking by other process. is
there any way to find thich file is locking a particular file.

thanks a lot

song wang

 
 
 

how to figure out which process is locking a file

Post by ynots.. » Sun, 17 Oct 1999 04:00:00




...

Quote:> I'm currently get a message saying a file is locking by other process.
> is there any way to find thich file is locking a particular file.

...

Get lsof ([l]i[s]t [o]pen [f]iles) from http://sunfreeware.com. It will
tell you what files are in use by what processes, as well as port usage
and many other useful items, depending on the command-line options you
choose.

-   tony

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

how to figure out which process is locking a file

Post by andrew_gar.. » Sun, 17 Oct 1999 04:00:00


Quote:>>I'm currently get a message saying a file is locking by other process.
>>is there any way to find thich file is locking a particular file.
>Get lsof ([l]i[s]t [o]pen [f]iles) from http://sunfreeware.com. It will
>tell you what files are in use by what processes, as well as port usage
>and many other useful items, depending on the command-line options you
>choose.

There is also the 'lockstat' which can be used in conjunction with any
binary file, to report the locking statistics.

I recommend you learn both 'lsof' and 'lockstat' as both are useful.

--
Regards,

Andrew Garman
Bluestone Consulting, inc.

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

how to figure out which process is locking a file

Post by Vic Abe » Thu, 21 Oct 1999 04:00:00




>However, there remains the problem of identifying which *system* the process
>identified by l_pid is on. The question of how to map l_sysid values onto
>hosts has been asked before, but I have never seen it answered satisfactorily.

Get the source to lslk from:

        ftp://vic.cc.purdue.edu/pub/tools/unix/lslk

The readsysids() function in lslk/dialects/solaris/dlock.c
will show how to read the lock manager's sysid information
on Solaris 2.5 and above.  (I haven't tried it yet on
Solaris 8 Beta.)

Vic Abell

 
 
 

1. Figuring out what process has a file locked

Sometimes you want to unmount a partition but you can't because you
get the classic "device or resource busy".  I don't know of any way
to figure out WHAT process has the device busy (so I could kill it
for example).  The closest I can come is to look in /proc/locks to
see which files are locked, however this will only show the inodes of
those files.  How do I find the corresponding file names (find -inum
works but is SLOW)?  Will this even give me the info I want?  For
example suppose I've got a shell open with a current working
directory of /home/foobar.  It doesn't appear that a lock for this
directory appears in /proc/locks, but I still won't be able to
unmount the file system containing /home/foobar.  Other possabilities
would include digging through the process entries in /proc and
finding what files each process has open, etc. but this seems much
too hard.  Is there an easy way to get this info?

Thanks.

2. telnet slowly

3. Modem lock outs

4. congratulations son.....you trashed your root partition

5. Am I figuring out this disk path correctly?

6. dbm code for httpd1.4.1

7. Error when compiling - trying to figure what I am missing

8. Trouble with sound!

9. Error when compiling - Trying to figure out what i am missing.

10. How do I figure out which version of KDE I am using?

11. Error when compliling - trying to figure out what i am missing.

12. Error while compiling - Trying to figure out what I am missing

13. Is there a way to lock file between threads in one process?