* [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes
@ 2026-03-27 15:11 Olga Kornievskaia
2026-04-08 19:03 ` Olga Kornievskaia
2026-04-13 21:21 ` Trond Myklebust
0 siblings, 2 replies; 3+ messages in thread
From: Olga Kornievskaia @ 2026-03-27 15:11 UTC (permalink / raw)
To: trond.myklebust, anna; +Cc: linux-nfs
xfstest generic/407 is failing in 2 ways. It detects that after
doing a clone the client does not update it's mtime and it's ctime.
CLONE always sends a GETATTR operation and then calls
nfs_post_op_update_inode() based on the returned attributes.
Because of the delegated attributes the client ignores updating
the mtime. Then also, when delegated attributes are present, for
the change_attr the server replies with the same values as what
the client cached before and thus the generic/407 would flag that.
Instead, make sure we invalidate the blocks attr.
Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
---
fs/nfs/nfs42proc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 7e5c1172fc11..f6a7cfa12225 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -1306,7 +1306,15 @@ static int _nfs42_proc_clone(struct rpc_message *msg, struct file *src_f,
if (count == 0 && res.dst_fattr->valid & NFS_ATTR_FATTR_SIZE)
count = nfs_size_to_loff_t(res.dst_fattr->size) - dst_offset;
nfs42_copy_dest_done(dst_f, dst_offset, count, oldsize_dst);
- status = nfs_post_op_update_inode(dst_inode, res.dst_fattr);
+ nfs_update_delegated_mtime(dst_inode);
+ if (!nfs_have_delegated_attributes(dst_inode))
+ status = nfs_post_op_update_inode(dst_inode,
+ res.dst_fattr);
+ else {
+ spin_lock(&dst_inode->i_lock);
+ nfs_set_cache_invalid(dst_inode, NFS_INO_INVALID_BLOCKS);
+ spin_unlock(&dst_inode->i_lock);
+ }
}
kfree(res.dst_fattr);
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes
2026-03-27 15:11 [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes Olga Kornievskaia
@ 2026-04-08 19:03 ` Olga Kornievskaia
2026-04-13 21:21 ` Trond Myklebust
1 sibling, 0 replies; 3+ messages in thread
From: Olga Kornievskaia @ 2026-04-08 19:03 UTC (permalink / raw)
To: Olga Kornievskaia; +Cc: trond.myklebust, anna, linux-nfs
On Fri, Mar 27, 2026 at 11:17 AM Olga Kornievskaia <okorniev@redhat.com> wrote:
>
> xfstest generic/407 is failing in 2 ways. It detects that after
> doing a clone the client does not update it's mtime and it's ctime.
> CLONE always sends a GETATTR operation and then calls
> nfs_post_op_update_inode() based on the returned attributes.
> Because of the delegated attributes the client ignores updating
> the mtime. Then also, when delegated attributes are present, for
> the change_attr the server replies with the same values as what
> the client cached before and thus the generic/407 would flag that.
> Instead, make sure we invalidate the blocks attr.
>
> Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
This patch isn't needed if the server updates mtime/ctime after doing a CLONE.
> ---
> fs/nfs/nfs42proc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index 7e5c1172fc11..f6a7cfa12225 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -1306,7 +1306,15 @@ static int _nfs42_proc_clone(struct rpc_message *msg, struct file *src_f,
> if (count == 0 && res.dst_fattr->valid & NFS_ATTR_FATTR_SIZE)
> count = nfs_size_to_loff_t(res.dst_fattr->size) - dst_offset;
> nfs42_copy_dest_done(dst_f, dst_offset, count, oldsize_dst);
> - status = nfs_post_op_update_inode(dst_inode, res.dst_fattr);
> + nfs_update_delegated_mtime(dst_inode);
> + if (!nfs_have_delegated_attributes(dst_inode))
> + status = nfs_post_op_update_inode(dst_inode,
> + res.dst_fattr);
> + else {
> + spin_lock(&dst_inode->i_lock);
> + nfs_set_cache_invalid(dst_inode, NFS_INO_INVALID_BLOCKS);
> + spin_unlock(&dst_inode->i_lock);
> + }
> }
>
> kfree(res.dst_fattr);
> --
> 2.52.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes
2026-03-27 15:11 [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes Olga Kornievskaia
2026-04-08 19:03 ` Olga Kornievskaia
@ 2026-04-13 21:21 ` Trond Myklebust
1 sibling, 0 replies; 3+ messages in thread
From: Trond Myklebust @ 2026-04-13 21:21 UTC (permalink / raw)
To: Olga Kornievskaia, anna; +Cc: linux-nfs
On Fri, 2026-03-27 at 11:11 -0400, Olga Kornievskaia wrote:
> xfstest generic/407 is failing in 2 ways. It detects that after
> doing a clone the client does not update it's mtime and it's ctime.
> CLONE always sends a GETATTR operation and then calls
> nfs_post_op_update_inode() based on the returned attributes.
> Because of the delegated attributes the client ignores updating
> the mtime. Then also, when delegated attributes are present, for
> the change_attr the server replies with the same values as what
> the client cached before and thus the generic/407 would flag that.
> Instead, make sure we invalidate the blocks attr.
>
> Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and
> mtime attributes")
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
> ---
> fs/nfs/nfs42proc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index 7e5c1172fc11..f6a7cfa12225 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -1306,7 +1306,15 @@ static int _nfs42_proc_clone(struct
> rpc_message *msg, struct file *src_f,
> if (count == 0 && res.dst_fattr->valid &
> NFS_ATTR_FATTR_SIZE)
> count = nfs_size_to_loff_t(res.dst_fattr-
> >size) - dst_offset;
> nfs42_copy_dest_done(dst_f, dst_offset, count,
> oldsize_dst);
> - status = nfs_post_op_update_inode(dst_inode,
> res.dst_fattr);
> + nfs_update_delegated_mtime(dst_inode);
> + if (!nfs_have_delegated_attributes(dst_inode))
> + status = nfs_post_op_update_inode(dst_inode,
> +
> res.dst_fattr);
> + else {
> + spin_lock(&dst_inode->i_lock);
> + nfs_set_cache_invalid(dst_inode,
> NFS_INO_INVALID_BLOCKS);
> + spin_unlock(&dst_inode->i_lock);
> + }
Why not call nfs_post_op_update_inode() instead of setting
NFS_INO_INVALID_BLOCKS? It should be safe to do so.
> }
>
> kfree(res.dst_fattr);
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trondmy@kernel.org, trond.myklebust@hammerspace.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-13 21:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 15:11 [PATCH 1/1] NFSv4.2: fix CLONE attrs in presence of delegated attributes Olga Kornievskaia
2026-04-08 19:03 ` Olga Kornievskaia
2026-04-13 21:21 ` Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox