aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2019-06-10 13:36:57 -0400
committerSteve French <stfrench@microsoft.com>2019-07-18 15:03:03 -0400
commitbf3c90ee1efe4dd3417d2129f9f6c68a4c76de00 (patch)
treecea2317aa589975e3a9f94b75ef292f1d5912717 /fs/cifs
parent7e5a70ad88b1e6f6d9b934b2efb41afff496820f (diff)
cifs: copy_file_range needs to strip setuid bits and update timestamps
cifs has both source and destination inodes locked throughout the copy. Like ->write_iter(), we update mtime and strip setuid bits of destination file before copy and like ->read_iter(), we update atime of source file after copy. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsfs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 270d3c58fb3b..3289b566463f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1104,6 +1104,10 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
1104 goto out; 1104 goto out;
1105 } 1105 }
1106 1106
1107 rc = -EOPNOTSUPP;
1108 if (!target_tcon->ses->server->ops->copychunk_range)
1109 goto out;
1110
1107 /* 1111 /*
1108 * Note: cifs case is easier than btrfs since server responsible for 1112 * Note: cifs case is easier than btrfs since server responsible for
1109 * checks for proper open modes and file type and if it wants 1113 * checks for proper open modes and file type and if it wants
@@ -1115,11 +1119,12 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
1115 /* should we flush first and last page first */ 1119 /* should we flush first and last page first */
1116 truncate_inode_pages(&target_inode->i_data, 0); 1120 truncate_inode_pages(&target_inode->i_data, 0);
1117 1121
1118 if (target_tcon->ses->server->ops->copychunk_range) 1122 rc = file_modified(dst_file);
1123 if (!rc)
1119 rc = target_tcon->ses->server->ops->copychunk_range(xid, 1124 rc = target_tcon->ses->server->ops->copychunk_range(xid,
1120 smb_file_src, smb_file_target, off, len, destoff); 1125 smb_file_src, smb_file_target, off, len, destoff);
1121 else 1126
1122 rc = -EOPNOTSUPP; 1127 file_accessed(src_file);
1123 1128
1124 /* force revalidate of size and timestamps of target file now 1129 /* force revalidate of size and timestamps of target file now
1125 * that target is updated on the server 1130 * that target is updated on the server