Skip to content

Commit 0e67051

Browse files
committed
Revert "cifs: Fix the target file was deleted when rename failed."
This reverts commit 9ffad92. Upon additional testing with older servers, it was found that the original commit introduced a regression when using the old SMB1 dialect and rsyncing over an existing file. The patch will need to be respun to address this, likely including a larger refactoring of the SMB1 and SMB3 rename code paths to make it less confusing and also to address some additional rename error cases that SMB3 may be able to workaround. Signed-off-by: Steve French <[email protected]> Reported-by: Patrick Fernie <[email protected]> CC: Stable <[email protected]> Acked-by: Ronnie Sahlberg <[email protected]> Acked-by: Pavel Shilovsky <[email protected]> Acked-by: Zhang Xiaoxu <[email protected]>
1 parent ba47d84 commit 0e67051

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

fs/cifs/inode.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
20442044
FILE_UNIX_BASIC_INFO *info_buf_target;
20452045
unsigned int xid;
20462046
int rc, tmprc;
2047-
bool new_target = d_really_is_negative(target_dentry);
20482047

20492048
if (flags & ~RENAME_NOREPLACE)
20502049
return -EINVAL;
@@ -2121,13 +2120,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
21212120
*/
21222121

21232122
unlink_target:
2124-
/*
2125-
* If the target dentry was created during the rename, try
2126-
* unlinking it if it's not negative
2127-
*/
2128-
if (new_target &&
2129-
d_really_is_positive(target_dentry) &&
2130-
(rc == -EACCES || rc == -EEXIST)) {
2123+
/* Try unlinking the target dentry if it's not negative */
2124+
if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
21312125
if (d_is_dir(target_dentry))
21322126
tmprc = cifs_rmdir(target_dir, target_dentry);
21332127
else

0 commit comments

Comments
 (0)