Re: [PATCH 10/15] __d_add(): don't drop/regain ->d_lock

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

 



On Sat, 2016-04-16 at 01:55 +0100, Al Viro wrote:
> From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> 
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---
>  fs/dcache.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index e9de4d9..33cad8a 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -2363,11 +2363,19 @@ EXPORT_SYMBOL(d_rehash);
>  
>  static inline void __d_add(struct dentry *dentry, struct inode *inode)
>  {
> +	spin_lock(&dentry->d_lock);
>  	if (inode) {
> -		__d_instantiate(dentry, inode);
> +		unsigned add_flags = d_flags_for_inode(inode);
> +		hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
> +		raw_write_seqcount_begin(&dentry->d_seq);
> +		__d_set_inode_and_type(dentry, inode, add_flags);
> +		raw_write_seqcount_end(&dentry->d_seq);
> +		__fsnotify_d_instantiate(dentry);

Should the above be a new __d_instantiate_locked instead of open-coding 
it?

> +	}
> +	_d_rehash(dentry);
> +	spin_unlock(&dentry->d_lock);
> +	if (inode)
>  		spin_unlock(&inode->i_lock);
> -	}
> -	d_rehash(dentry);
>  }
>  
>  /**
-- 
Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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