Skip to content

Commit 2049750

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS: Ensure the server has an up to date ctime before hardlinking
Creating a hard link 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: 9f76827 ("NFS: Move the delegation return down into nfs4_proc_link()") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 6238aec commit 2049750

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
@@ -2379,6 +2379,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
23792379

23802380
trace_nfs_link_enter(inode, dir, dentry);
23812381
d_drop(dentry);
2382+
if (S_ISREG(inode->i_mode))
2383+
nfs_sync_inode(inode);
23822384
error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
23832385
if (error == 0) {
23842386
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));

0 commit comments

Comments
 (0)