@@ -915,6 +915,16 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old,
ovl_dentry_version_inc(old->d_parent);
ovl_dentry_version_inc(new->d_parent);
+ /*
+ *FS_RENAME_DOES_D_MOVE is set in fs_flags, we need to do d_move/d_exchange
+ *by ourselves. overwrite means no RENAME_EXCHANGE in flags, just do d_move;
+ *d_exchange otherwise.
+ */
+ if (overwrite)
+ d_move(old, new);
+ else
+ d_exchange(old, new);
+
out_dput:
dput(newdentry);
out_unlock:
@@ -1097,6 +1097,7 @@ static struct file_system_type ovl_fs_type = {
.name = "overlay",
.mount = ovl_mount,
.kill_sb = kill_anon_super,
+ .fs_flags = FS_RENAME_DOES_D_MOVE,
};
MODULE_ALIAS_FS("overlay");