From: Shachar Sharon Date: Thu, 20 Jun 2024 09:43:39 +0000 (+0300) Subject: vfs_ceph_new: use low-level APIs for fsync X-Git-Tag: tdb-1.4.12~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e15586fc6097565208011c556282d83eeec2230b;p=thirdparty%2Fsamba.git vfs_ceph_new: use low-level APIs for fsync Implement fsync operation using libcephfs' low-level APIs. Requires open ceph Fh* associated with fsp (extension). BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686 Signed-off-by: Shachar Sharon Reviewed-by: Guenther Deschner Reviewed-by: Anoop C S --- diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index fbdfe114939..68e514599ab 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -915,6 +915,13 @@ static off_t vfs_ceph_ll_lseek(const struct vfs_handle_struct *handle, return ceph_ll_lseek(cmount_of(handle), cfh->fh, offset, whence); } +static int vfs_ceph_ll_fsync(const struct vfs_handle_struct *handle, + const struct vfs_ceph_fh *cfh, + int syncdataonly) +{ + return ceph_ll_fsync(cmount_of(handle), cfh->fh, syncdataonly); +} + /* Ceph Inode-refernce get/put wrappers */ static int vfs_ceph_iget(const struct vfs_handle_struct *handle, uint64_t ino, @@ -1577,6 +1584,7 @@ static struct tevent_req *vfs_ceph_fsync_send(struct vfs_handle_struct *handle, struct tevent_context *ev, files_struct *fsp) { + struct vfs_ceph_fh *cfh = NULL; struct tevent_req *req = NULL; struct vfs_aio_state *state = NULL; int ret = -1; @@ -1588,9 +1596,14 @@ static struct tevent_req *vfs_ceph_fsync_send(struct vfs_handle_struct *handle, return NULL; } - /* Make sync call. */ - ret = ceph_fsync(cmount_of(handle), fsp_get_io_fd(fsp), false); + ret = vfs_ceph_fetch_io_fh(handle, fsp, &cfh); + if (ret != 0) { + tevent_req_error(req, -ret); + return tevent_req_post(req, ev); + } + /* Make sync call. */ + ret = vfs_ceph_ll_fsync(handle, cfh, false); if (ret != 0) { /* ceph_fsync returns -errno on error. */ tevent_req_error(req, -ret);