Skip to content

Commit bf3c90e

Browse files
amir73ilsmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7e5a70a commit bf3c90e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/cifs/cifsfs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,10 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
11041104
goto out;
11051105
}
11061106

1107+
rc = -EOPNOTSUPP;
1108+
if (!target_tcon->ses->server->ops->copychunk_range)
1109+
goto out;
1110+
11071111
/*
11081112
* Note: cifs case is easier than btrfs since server responsible for
11091113
* 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,
11151119
/* should we flush first and last page first */
11161120
truncate_inode_pages(&target_inode->i_data, 0);
11171121

1118-
if (target_tcon->ses->server->ops->copychunk_range)
1122+
rc = file_modified(dst_file);
1123+
if (!rc)
11191124
rc = target_tcon->ses->server->ops->copychunk_range(xid,
11201125
smb_file_src, smb_file_target, off, len, destoff);
1121-
else
1122-
rc = -EOPNOTSUPP;
1126+
1127+
file_accessed(src_file);
11231128

11241129
/* force revalidate of size and timestamps of target file now
11251130
* that target is updated on the server

0 commit comments

Comments
 (0)