diff options
author | David Disseldorp <ddiss@samba.org> | 2019-02-26 21:26:27 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-03-04 10:37:56 +0000 |
commit | 15ef70cb53a038847f424a7881bcbc09f8e0a80f (patch) | |
tree | 25ab0a56abddfd4dd8af0f7883792c0cec22d0e4 | |
parent | 13bf811858fe41f30960871b0618b3c53cacf1dc (diff) | |
download | samba-15ef70cb53a038847f424a7881bcbc09f8e0a80f.tar.gz |
vfs_ceph: add missing fallocate hook
SMB_VFS_FALLOCATE() calls atop a vfs_ceph share currently fall through
to vfs_default, which results in a local filesystem I/O attempt using a
libcephfs file-descriptor. Add the missing fallocate hook to vfs_ceph.
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 5a7e7280813559fb70a9fc8e4238cb6015ee3b53)
-rw-r--r-- | source3/modules/vfs_ceph.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 47371bc9e08..9f111bea2a0 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1155,6 +1155,22 @@ static int cephwrap_ftruncate(struct vfs_handle_struct *handle, files_struct *fs return result; } +static int cephwrap_fallocate(struct vfs_handle_struct *handle, + struct files_struct *fsp, + uint32_t mode, + off_t offset, + off_t len) +{ + int result; + + DBG_DEBUG("[CEPH] fallocate(%p, %p, %u, %llu, %llu\n", + handle, fsp, mode, llu(offset), llu(len)); + /* unsupported mode flags are rejected by libcephfs */ + result = ceph_fallocate(handle->data, fsp->fh->fd, mode, offset, len); + DBG_DEBUG("[CEPH] fallocate(...) = %d\n", result); + WRAP_RETURN(result); +} + static bool cephwrap_lock(struct vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type) { DBG_DEBUG("[CEPH] lock\n"); @@ -1513,6 +1529,7 @@ static struct vfs_fn_pointers ceph_fns = { .getwd_fn = cephwrap_getwd, .ntimes_fn = cephwrap_ntimes, .ftruncate_fn = cephwrap_ftruncate, + .fallocate_fn = cephwrap_fallocate, .lock_fn = cephwrap_lock, .kernel_flock_fn = cephwrap_kernel_flock, .linux_setlease_fn = cephwrap_linux_setlease, |