Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ff9d99

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS: Ensure the server has an up to date ctime before renaming
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 <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 2049750 commit 6ff9d99

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/nfs/dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,6 +2470,8 @@ int nfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
24702470
}
24712471
}
24722472

2473+
if (S_ISREG(old_inode->i_mode))
2474+
nfs_sync_inode(old_inode);
24732475
task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
24742476
if (IS_ERR(task)) {
24752477
error = PTR_ERR(task);

0 commit comments

Comments
 (0)