]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:vfs_crossrename: add back checking for errno ENOENT
authorJones Syue <jonessyue@qnap.com>
Thu, 26 Sep 2024 09:17:14 +0000 (17:17 +0800)
committerJule Anger <janger@samba.org>
Thu, 19 Dec 2024 09:36:12 +0000 (09:36 +0000)
strace gives a clue: samba try to remove 'file.txt' in the dst folder but
actually it is not existed yet, and got an errno = ENOENT,

renameat(32, "file.txt", 31, "file.txt") = -1 EXDEV (Invalid cross-device link)
unlinkat(31, "file.txt", 0)             = -1 ENOENT (No such file or directory)

Commit 5c18f074be92 ("s3: VFS: crossrename. Use real dirfsp for
SMB_VFS_RENAMEAT()") seems unintentionally removed errno ENOENT checking,
so add it back could address 1st issue.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15724

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 1a089a16c40e0b3bc5d4fcde559157cf137056c2)

source3/modules/vfs_crossrename.c

index a4f035d3141f005bec1a2992fdbaaa858b3008f4..1da36706ecb4c19adfd66794dc87f87e428f4aff 100644 (file)
@@ -85,7 +85,7 @@ static NTSTATUS copy_reg(vfs_handle_struct *handle,
                                    dstfsp,
                                    dest,
                                    0);
-       if (ret == -1) {
+       if (ret == -1 && errno != ENOENT) {
                status = map_nt_error_from_unix(errno);
                goto out;
        }