NFSv4.2: fix CLONE/COPY attrs in presence of delegated attributes
Subsystems (2)
Olga Kornievskaia
reviewerPATCH v4 1/1 NFSv4.2: fix CLONE/COPY attrs in presence of delegated attributes
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.
By adding updating delegated attributes in nfs42_copy_dest_done() both COPY and CLONE would update mtime appropriately.
--v4 this version removes the need for having "NFSv4.2: fix COPY attrs in presence of delegated timestamps"
--- fs/nfs/nfs42proc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/nfs/nfs42proc.c +9 -1
@@ -393,6 +393,7 @@ static void nfs42_copy_dest_done(struct file *file, loff_t pos, loff_t len,WARN_ON_ONCE (invalidate_inode_pages2_range (mapping, pos >>PAGE_SHIFT , end >>PAGE_SHIFT )); +nfs_update_delegated_mtime (inode);spin_lock (&inode->i_lock);if (newsize >i_size_read (inode))i_size_write (inode, newsize);
@@ -1306,7 +1307,14 @@ 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); +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);
Signature · 1 line
2.52.0