Re: generic/430 COPY/delegation caching regression

Trond Myklebust
2021-04-14T03:09:23Z

On Tue, 2021-04-13 at 19:19 -0400, J. Bruce Fields wrote:
> generic/430 started failing in 4.12-rc3, as of 7c1d1dcc24b3 "nfsd:
> grant
> read delegations to clients holding writes".
>
> Looks like that reintroduced the problem fixed by 16abd2a0c124
> "NFSv4.2:
> fix client's attribute cache management for copy_file_range": the
> client
> needs to invalidate its cache of the destination of a copy even when it
> holds a delegation.
>
> --b.

Hmm.. The only thing I see that could be causing an issue is the fact
that we're relying on cache invalidation to change the file size.

nfs_set_cache_invalid(
dst_inode, NFS_INO_REVAL_PAGECACHE | NFS_INO_REVAL_FORCED |
NFS_INO_INVALID_SIZE | NFS_INO_INVALID_ATTR |
NFS_INO_INVALID_DATA);

The only problem there is that nfs_set_cache_invalid() will clobber the
NFS_INO_INVALID_SIZE because if we hold a delegation, then our client
is the sole authority for the size attribute (hence we don't allow it
to be invalidated). We therefore expect a call to i_size_write(), if
the file size grew.

Otherwise, the setting of NFS_INO_INVALID_DATA should be redundant
because we've already punched a hole with truncate_pagecache_range().

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com