From: Ralph Boehme Date: Fri, 29 Nov 2024 12:04:36 +0000 (+0100) Subject: smbd: check for VFS_PWRITE_APPEND_OFFSET in vfs_fill_sparse() X-Git-Tag: tdb-1.4.13~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f67ad08bc696b58cb416f45897ea1f7b3dd4f908;p=thirdparty%2Fsamba.git smbd: check for VFS_PWRITE_APPEND_OFFSET in vfs_fill_sparse() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 512fa361a15..76732691c09 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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;