How do I know which processes are locking a specific branch?

Let me state the question using a basic example.

 > mkdir -p union branch1 branch2
 > touch branch1/branch1_file
 > touch branch2/branch2_file
 > mount -t aufs aufs union -o br:branch1:branch2

# produces expected union
 > ls union/
branch1_file  branch2_file

# Now use tail -f in separate terminals to simulate normal locked files.
 > tail -f union/branch1_file
 > tail -f union/branch2_file


# Any manipulation on the union results in locked file errors
 > mount union -o remount,del:branch1
mount: /tmp/union is busy

# Killing the correct process, frees the lock
 > lsof
COMMAND    PID USER   FD      TYPE     DEVICE SIZE/OFF       NODE NAME
tail      1390 root    3r      REG       0,13        0         12 
/tmp/union/branch1_file
tail      1399 root    3r      REG       0,13        0         13 
/tmp/union/branch2_file
...

 > kill 1390

 > mount union -o remount,del:branch1
[ 2299.055549] aufs au_opts_verify:1369:mount[1412]: first branch should 
be rw

# I forgot to set branch2=rw, but it works.


In this example, I knew which process was locking branch1, but on a 
running system, how can I tell?
I can kill all processes running on device (0,13), but is there any way 
to identify just the processes which are locking a specific branch?

LG


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

Reply via email to