From: Jones Syue Date: Thu, 26 Sep 2024 09:17:14 +0000 (+0800) Subject: s3:vfs_crossrename: add back checking for errno ENOENT X-Git-Tag: samba-4.20.7~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1e28919ae49c65fba48a0d84f94e3b962dd53ca;p=thirdparty%2Fsamba.git s3:vfs_crossrename: add back checking for errno ENOENT 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 Reviewed-by: Ralph Boehme (cherry picked from commit 1a089a16c40e0b3bc5d4fcde559157cf137056c2) --- diff --git a/source3/modules/vfs_crossrename.c b/source3/modules/vfs_crossrename.c index a4f035d3141..1da36706ecb 100644 --- a/source3/modules/vfs_crossrename.c +++ b/source3/modules/vfs_crossrename.c @@ -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; }