]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: check for VFS_PWRITE_APPEND_OFFSET in vfs_fill_sparse()
authorRalph Boehme <slow@samba.org>
Fri, 29 Nov 2024 12:04:36 +0000 (13:04 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 7 Jan 2025 22:04:33 +0000 (22:04 +0000)
This is the only place a function dealing with allocation and file length being
called from the write IO path. In the case of POSIX append-IO with
offset=VFS_PWRITE_APPEND_OFFSET vfs_fill_sparse() must be a noop.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/vfs.c

index 512fa361a15775a39cbb844f79a3b9beb99c3ae8..76732691c0913a36960b9f5a1ae89e555627b9f6 100644 (file)
@@ -731,6 +731,10 @@ int vfs_fill_sparse(files_struct *fsp, off_t len)
        size_t num_to_write;
        bool ok;
 
+       if (len == VFS_PWRITE_APPEND_OFFSET) {
+               return 0;
+       }
+
        ok = vfs_valid_allocation_range(len, 0);
        if (!ok) {
                errno = EINVAL;