From: Shachar Sharon Date: Thu, 20 Jun 2024 09:23:03 +0000 (+0300) Subject: vfs_ceph_new: use low-level APIs for lseek X-Git-Tag: tdb-1.4.12~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30c1a613fee3f625c0559e49e037af9fad04c3b8;p=thirdparty%2Fsamba.git vfs_ceph_new: use low-level APIs for lseek Implement lseek 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 2c96cc92442..fbdfe114939 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -907,6 +907,14 @@ static int vfs_ceph_ll_write(const struct vfs_handle_struct *handle, return ceph_ll_write(cmount_of(handle), cfh->fh, off, len, data); } +static off_t vfs_ceph_ll_lseek(const struct vfs_handle_struct *handle, + const struct vfs_ceph_fh *cfh, + off_t offset, + int whence) +{ + return ceph_ll_lseek(cmount_of(handle), cfh->fh, offset, whence); +} + /* Ceph Inode-refernce get/put wrappers */ static int vfs_ceph_iget(const struct vfs_handle_struct *handle, uint64_t ino, @@ -1475,13 +1483,17 @@ static off_t vfs_ceph_lseek(struct vfs_handle_struct *handle, off_t offset, int whence) { - off_t result = 0; + struct vfs_ceph_fh *cfh = NULL; + intmax_t result = 0; DBG_DEBUG("[CEPH] vfs_ceph_lseek\n"); - result = ceph_lseek(cmount_of(handle), - fsp_get_io_fd(fsp), - offset, - whence); + result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh); + if (result != 0) { + goto out; + } + + result = vfs_ceph_ll_lseek(handle, cfh, offset, whence); +out: return lstatus_code(result); }