Re: dcache locking question

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

 



On Fri, Mar 15, 2019 at 09:56:32AM +1100, Tobin C. Harding wrote:
> 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
> 

This is a more simple example

static struct dentry *dentry_kill(struct dentry *dentry)
	__releases(dentry->d_lock)
{
        ...

slow_positive:
	spin_unlock(&dentry->d_lock);
	spin_lock(&inode->i_lock);
	spin_lock(&dentry->d_lock);
	parent = lock_parent(dentry);

        ...

thanks,
Tobin.




[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