summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2019-02-26 16:07:27 +0100
committerKarolin Seeger <kseeger@samba.org>2019-03-04 10:37:56 +0000
commitba75d5f483911b0f44828a0e9cfc35cfd7dfe4c6 (patch)
treefd3604f5a69e0944be035e27010517f1a23f144b
parent15ef70cb53a038847f424a7881bcbc09f8e0a80f (diff)
downloadsamba-ba75d5f483911b0f44828a0e9cfc35cfd7dfe4c6.tar.gz
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 <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit 70329c36ed91dd0e50ff66f9b0a85c62ac8a621e)
-rw-r--r--source3/modules/vfs_ceph.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 9f111bea2a0..4a705ea14a3 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1053,8 +1053,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;