Revert "cifs: Fix the target file was deleted when rename failed."
This reverts commit 9ffad9263b
.
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>
This commit is contained in:
parent
ba47d845d7
commit
0e6705182d
|
@ -2044,7 +2044,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
|
||||||
FILE_UNIX_BASIC_INFO *info_buf_target;
|
FILE_UNIX_BASIC_INFO *info_buf_target;
|
||||||
unsigned int xid;
|
unsigned int xid;
|
||||||
int rc, tmprc;
|
int rc, tmprc;
|
||||||
bool new_target = d_really_is_negative(target_dentry);
|
|
||||||
|
|
||||||
if (flags & ~RENAME_NOREPLACE)
|
if (flags & ~RENAME_NOREPLACE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -2121,13 +2120,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unlink_target:
|
unlink_target:
|
||||||
/*
|
/* Try unlinking the target dentry if it's not negative */
|
||||||
* If the target dentry was created during the rename, try
|
if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
|
||||||
* unlinking it if it's not negative
|
|
||||||
*/
|
|
||||||
if (new_target &&
|
|
||||||
d_really_is_positive(target_dentry) &&
|
|
||||||
(rc == -EACCES || rc == -EEXIST)) {
|
|
||||||
if (d_is_dir(target_dentry))
|
if (d_is_dir(target_dentry))
|
||||||
tmprc = cifs_rmdir(target_dir, target_dentry);
|
tmprc = cifs_rmdir(target_dir, target_dentry);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue