Re: [PATCH 07/12] namei: minor vfs_unlink cleanup

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

 



On Wed,  3 Jul 2013 16:12:31 -0400
"J. Bruce Fields" <bfields@xxxxxxxxxx> wrote:

> From: "J. Bruce Fields" <bfields@xxxxxxxxxx>
> 
> We'll be using dentry->d_inode in one more place.
> 
> Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
> ---
>  fs/namei.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 61f6076..7e76fe1 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3386,6 +3386,7 @@ SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
>  
>  int vfs_unlink(struct inode *dir, struct dentry *dentry)
>  {
> +	struct inode *target = dentry->d_inode;
>  	int error = may_delete(dir, dentry, 0);
>  
>  	if (error)
> @@ -3394,7 +3395,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
>  	if (!dir->i_op->unlink)
>  		return -EPERM;
>  
> -	mutex_lock(&dentry->d_inode->i_mutex);
> +	mutex_lock(&target->i_mutex);
>  	if (d_mountpoint(dentry))
>  		error = -EBUSY;
>  	else {
> @@ -3405,11 +3406,11 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
>  				dont_mount(dentry);
>  		}
>  	}
> -	mutex_unlock(&dentry->d_inode->i_mutex);
> +	mutex_unlock(&target->i_mutex);
>  
>  	/* We don't d_delete() NFS sillyrenamed files--they still exist. */
>  	if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
> -		fsnotify_link_count(dentry->d_inode);
> +		fsnotify_link_count(target);
>  		d_delete(dentry);
>  	}
>  

Acked-by: Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux