Re: [Linux-cachefs] [RFC PATCH v2 13/14] NFS: Call fscache_resize_cookie() when inode size changes due to setattr

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

 



On Wed, 2020-07-29 at 10:12 -0400, Dave Wysochanski wrote:
> Handle truncate / setattr when fscache is enabled by calling
> fscache_resize_cookie().
> 
> Signed-off-by: Dave Wysochanski <dwysocha@xxxxxxxxxx>
> ---
>  fs/nfs/inode.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 45067303348c..6b814246d07d 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -667,6 +667,7 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset)
>  	spin_unlock(&inode->i_lock);
>  	truncate_pagecache(inode, offset);
>  	spin_lock(&inode->i_lock);
> +	fscache_resize_cookie(nfs_i_fscache(inode), i_size_read(inode));
>  out:
>  	return err;
>  }

truncate can happen even when you have no open file descriptors on the
file and therefore w/o the cookie being "used". In the ceph vmtruncate
handling code, I do an explicit use/unuse around this call. Do you need
to do the same here?
-- 
Jeff Layton <jlayton@xxxxxxxxxx>




[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