dcache locking question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm not able to understand the locking order in dcache.  dcache has been
around for a while so clearly its right and I'm wrong.

Could someone please explain to me how the locking order commented at
the top of the file is not violated in the following:

>From top of fs/dcache.c

 * If there is an ancestor relationship:
 * dentry->d_parent->...->d_parent->d_lock
 *   ...
 *     dentry->d_parent->d_lock
 *       dentry->d_lock


dentry_kill() appears to require caller to hold the dentry->d_lock yet
it locks the parent with spin_trylock(&parent->d_lock), if this
fails it calls __lock_parent() which releases the dentry->d_lock before
locking the parent and re-acquiring [1] the dentry->d_lock .  Is this not
locking in two different orders? 

The same logic exists in lock_parent().

thanks,
Tobin.


[1] I do not fully understand the spin_lock_nested() macro.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux