> It's not possible for two tasks to deadlock when acquiring locks in a
> tree structure provided that the locks are always acquired going down
> a branch. (Or if the locks are always acquired going up a branch.)
That's not what you said before! It sounded like you were describing a situation where task A
acquires locks walking down the tree and simultaneously task B acquires locks walking up the
tree. That can't work.
lockdep does manage to handle situations like the VFS where we have i_mutex protecting each
inode and some rather byzantine rules regarding which have to be locked first (it's
particularly hairy when doing cross-directory renames -- you have to lock the renamed object,
its parent and the destination directory. While not deadlocking against any other operation
happening at the same time).
So your assertion is demonstratedly untrue, but you still can't give semaphores an owner.