How to read /proc/locks in safe mode?

Dario Lesca d.lesca at solinos.it
Fri Jul 15 16:21:49 UTC 2011


Il giorno ven, 15/07/2011 alle 11.57 -0400, Przemek Klosowski ha
scritto:
> 
> I can't think of anything to lock all the other processes on your
> system while your awk/cat is running, other than raising the priority
> of your process high enough.
> 
> Perhaps if you explained what you are trying to accomplish by your 
> processing of /proc/locks, people have some suggestions. Clearly your 
> situation is unusual---why do you have thousands of active locks? I 
> think a dozen or so is the norm (I have a fairly busy desktop with
> many sessions and programs open, and 20 locks are active right now). 

thanks Przemek

It's a server, and every user (>300) have ad least a lock on a specific
portion of the same file

The file /proc/locks contain also many other  (<5000) lines than those
lock and this virtual file is continuously modified.

If I try copy it (cp /proc/locks /tmp/l or cat /proc/locks>/tmp/l) two
times in succession, the result is always very different and the
abnormal line (more than 8 field) are like attachment of previous
message.

So, if I process this file with awk the result many time is
undefined ...

My goal is extract the lock line of a specific process an see if this
process lock a specific file and extract the offset lock.

This procedure work if none of user login or logout on the server, but
this condition is rare...

today have check the lslk utilities, but even it, if user login/logout
and work do not show the correct list: some time the result is wrong...

Thanks

-- 
Dario Lesca <d.lesca at solinos.it>



More information about the devel mailing list