From c539cf176a669e54ccddefa6b57a9285d12c93a9 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Tue, 26 Feb 2019 16:07:27 +0100 Subject: vfs_ceph: fix strict_allocate_ftruncate() The vfs_ceph "strict allocate = yes" ftruncate wrapper may attempt *local* filesystem ftruncate(). Fix this. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807 Signed-off-by: David Disseldorp Reviewed-by: Guenther Deschner (cherry picked from commit 70329c36ed91dd0e50ff66f9b0a85c62ac8a621e) --- source3/modules/vfs_ceph.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index f73a1f65187..c68a98f97e8 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1145,8 +1145,10 @@ static int strict_allocate_ftruncate(struct vfs_handle_struct *handle, files_str return 0; /* Shrink - just ftruncate. */ - if (pst->st_ex_size > len) - return ftruncate(fsp->fh->fd, len); + if (pst->st_ex_size > len) { + ret = ceph_ftruncate(handle->data, fsp->fh->fd, len); + WRAP_RETURN(ret); + } space_to_write = len - pst->st_ex_size; -- cgit v1.2.1