Re: [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate

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

 



Hi Trond,

On 05/29/2018 11:48 AM, Trond Myklebust wrote:
> If the file being sillyrenamed is being completely deleted, or
> we are using NFSv4.0, then we need to return the delegation before
> sending off the sillydelete.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> ---
>  fs/nfs/dir.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index b315f53b3aec..ed20ff51f865 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -1399,11 +1399,32 @@ EXPORT_SYMBOL_GPL(nfs_lookup);
>  #if IS_ENABLED(CONFIG_NFS_V4)
>  static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
>  
> +/*
> + * Called when the dentry loses inode.
> + * We use it to clean up silly-renamed files.
> + */
> +static void nfs4_dentry_iput(struct dentry *dentry, struct inode *inode)
> +{
> +	if (S_ISDIR(inode->i_mode))
> +		/* drop any readdir cache as it could easily be old */
> +		NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
> +
> +	if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
> +		if (inode->i_nlink == 1)
> +			nfs4_inode_return_delegation(inode);
> +		else
> +			nfs4_inode_make_writeable(inode);

I think these functions need to be exported in delegation.c to avoid undefined symbol warnings from the compiler.

Thanks,
Anna

> +		nfs_complete_unlink(dentry, inode);
> +		nfs_drop_nlink(inode);
> +	}
> +	iput(inode);
> +}
> +
>  const struct dentry_operations nfs4_dentry_operations = {
>  	.d_revalidate	= nfs4_lookup_revalidate,
>  	.d_weak_revalidate	= nfs_weak_revalidate,
>  	.d_delete	= nfs_dentry_delete,
> -	.d_iput		= nfs_dentry_iput,
> +	.d_iput		= nfs4_dentry_iput,
>  	.d_automount	= nfs_d_automount,
>  	.d_release	= nfs_d_release,
>  };
> 
--
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