Skip to content

Commit c7e9f78

Browse files
committed
cifs: do d_move in rename
See commit 349457c "Allow file systems to manually d_move() inside of ->rename()" Lessens possibility of race conditions in rename Signed-off-by: Steve French <[email protected]>
1 parent 69dda30 commit c7e9f78

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/cifs/cifsfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ struct file_system_type cifs_fs_type = {
10181018
.name = "cifs",
10191019
.mount = cifs_do_mount,
10201020
.kill_sb = cifs_kill_sb,
1021-
/* .fs_flags */
1021+
.fs_flags = FS_RENAME_DOES_D_MOVE,
10221022
};
10231023
MODULE_ALIAS_FS("cifs");
10241024

@@ -1027,7 +1027,7 @@ static struct file_system_type smb3_fs_type = {
10271027
.name = "smb3",
10281028
.mount = smb3_do_mount,
10291029
.kill_sb = cifs_kill_sb,
1030-
/* .fs_flags */
1030+
.fs_flags = FS_RENAME_DOES_D_MOVE,
10311031
};
10321032
MODULE_ALIAS_FS("smb3");
10331033
MODULE_ALIAS("smb3");

fs/cifs/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,8 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
18351835
CIFSSMBClose(xid, tcon, fid.netfid);
18361836
}
18371837
do_rename_exit:
1838+
if (rc == 0)
1839+
d_move(from_dentry, to_dentry);
18381840
cifs_put_tlink(tlink);
18391841
return rc;
18401842
}

0 commit comments

Comments
 (0)