From 868ca68cdfa3ccebf7b546cae426070482cc99c4 Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Tue, 4 Aug 2020 16:33:22 +0200 Subject: [PATCH] Revert "cifs: Fix the target file was deleted when rename failed." Closes: #966917 --- debian/changelog | 7 +++ ...the-target-file-was-deleted-when-ren.patch | 58 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 66 insertions(+) create mode 100644 debian/patches/bugfix/all/Revert-cifs-Fix-the-target-file-was-deleted-when-ren.patch diff --git a/debian/changelog b/debian/changelog index af7e6cf3a..46f05425c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +linux (4.19.132-2) UNRELEASED; urgency=medium + + * Revert "cifs: Fix the target file was deleted when rename failed." + (Closes: #966917) + + -- Salvatore Bonaccorso Tue, 04 Aug 2020 16:33:40 +0200 + linux (4.19.132-1) buster; urgency=medium * New upstream stable update: diff --git a/debian/patches/bugfix/all/Revert-cifs-Fix-the-target-file-was-deleted-when-ren.patch b/debian/patches/bugfix/all/Revert-cifs-Fix-the-target-file-was-deleted-when-ren.patch new file mode 100644 index 000000000..81247af4e --- /dev/null +++ b/debian/patches/bugfix/all/Revert-cifs-Fix-the-target-file-was-deleted-when-ren.patch @@ -0,0 +1,58 @@ +From: Steve French +Date: Thu, 23 Jul 2020 14:41:29 -0500 +Subject: Revert "cifs: Fix the target file was deleted when rename failed." +Origin: https://git.kernel.org/linus/0e6705182d4e1b77248a93470d6d7b3013d59b30 +Bug-Debian: https://bugs.debian.org/966917 + +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 +Reported-by: Patrick Fernie +CC: Stable +Acked-by: Ronnie Sahlberg +Acked-by: Pavel Shilovsky +Acked-by: Zhang Xiaoxu +--- + fs/cifs/inode.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c +index 49c3ea8aa845..ce95801e9b66 100644 +--- a/fs/cifs/inode.c ++++ b/fs/cifs/inode.c +@@ -2044,7 +2044,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, + FILE_UNIX_BASIC_INFO *info_buf_target; + unsigned int xid; + int rc, tmprc; +- bool new_target = d_really_is_negative(target_dentry); + + if (flags & ~RENAME_NOREPLACE) + return -EINVAL; +@@ -2121,13 +2120,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, + */ + + unlink_target: +- /* +- * If the target dentry was created during the rename, try +- * unlinking it if it's not negative +- */ +- if (new_target && +- d_really_is_positive(target_dentry) && +- (rc == -EACCES || rc == -EEXIST)) { ++ /* Try unlinking the target dentry if it's not negative */ ++ if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) { + if (d_is_dir(target_dentry)) + tmprc = cifs_rmdir(target_dir, target_dentry); + else +-- +2.28.0 + diff --git a/debian/patches/series b/debian/patches/series index d8bf92c5b..3dbbd0860 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -102,6 +102,7 @@ debian/revert-objtool-fix-config_stack_validation-y-warning.patch bugfix/all/mt76-use-the-correct-hweight8-function.patch bugfix/all/rtc-s35390a-set-uie_unsupported.patch bugfix/all/Revert-ath9k-Fix-general-protection-fault-in-ath9k_h.patch +bugfix/all/Revert-cifs-Fix-the-target-file-was-deleted-when-ren.patch # Miscellaneous features features/all/e1000e-Add-support-for-Comet-Lake.patch