Skip to content

Commit a9fb070

Browse files
smfrenchgregkh
authored andcommitted
Revert "cifs: Fix the target file was deleted when rename failed."
commit 0e6705182d4e1b77248a93470d6d7b3013d59b30 upstream. This reverts commit 9ffad9263b467efd8f8dc7ae1941a0a655a2bab2. 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 <stfrench@microsoft.com> Reported-by: Patrick Fernie <patrick.fernie@gmail.com> CC: Stable <stable@vger.kernel.org> Acked-by: Ronnie Sahlberg <lsahlber@redhat.com> Acked-by: Pavel Shilovsky <pshilov@microsoft.com> Acked-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 70db3c5 commit a9fb070

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

fs/cifs/inode.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
17781778
FILE_UNIX_BASIC_INFO *info_buf_target;
17791779
unsigned int xid;
17801780
int rc, tmprc;
1781-
bool new_target = d_really_is_negative(target_dentry);
17821781

17831782
if (flags & ~RENAME_NOREPLACE)
17841783
return -EINVAL;
@@ -1855,13 +1854,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
18551854
*/
18561855

18571856
unlink_target:
1858-
/*
1859-
* If the target dentry was created during the rename, try
1860-
* unlinking it if it's not negative
1861-
*/
1862-
if (new_target &&
1863-
d_really_is_positive(target_dentry) &&
1864-
(rc == -EACCES || rc == -EEXIST)) {
1857+
/* Try unlinking the target dentry if it's not negative */
1858+
if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
18651859
if (d_is_dir(target_dentry))
18661860
tmprc = cifs_rmdir(target_dir, target_dentry);
18671861
else

0 commit comments

Comments
 (0)