Skip to content

Commit 7a32824

Browse files
Trond Myklebustgregkh
authored andcommitted
NFS: Ensure the server has an up to date ctime before renaming
[ Upstream commit 6ff9d99 ] Renaming a file is required by POSIX to update the file ctime, so ensure that the file data is synced to disk so that we don't clobber the updated ctime by writing back after creating the hard link. Fixes: f2c2c55 ("NFS: Move delegation recall into the NFSv4 callback for rename_setup()") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 666f6ab commit 7a32824

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/nfs/dir.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,8 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
22822282
}
22832283
}
22842284

2285+
if (S_ISREG(old_inode->i_mode))
2286+
nfs_sync_inode(old_inode);
22852287
task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
22862288
if (IS_ERR(task)) {
22872289
error = PTR_ERR(task);

0 commit comments

Comments
 (0)