vfs_ceph: Use ceph_fdopendir() when available for SMB_VFS_FDOPENDIR
authorAnoop C S <anoopcs@samba.org>
Tue, 16 Jan 2024 06:17:27 +0000 (11:47 +0530)
committerGünther Deschner <gd@samba.org>
Sat, 27 Jan 2024 00:01:12 +0000 (00:01 +0000)
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Sat Jan 27 00:01:12 UTC 2024 on atb-devel-224

source3/modules/vfs_ceph.c
source3/wscript

index 4387918198e99b32b33341425a8920013b1999a4..c9ee5414f038a3ea5a0b6ffb9fee9ee5e4e5702f 100644 (file)
@@ -438,9 +438,15 @@ static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle,
 {
        int ret = 0;
        struct ceph_dir_result *result = NULL;
-       DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp);
 
+#ifdef HAVE_CEPH_FDOPENDIR
+       int dirfd = fsp_get_io_fd(fsp);
+       DBG_DEBUG("[CEPH] fdopendir(%p, %d)\n", handle, dirfd);
+       ret = ceph_fdopendir(handle->data, dirfd, &result);
+#else
+       DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp);
        ret = ceph_opendir(handle->data, fsp->fsp_name->base_name, &result);
+#endif
        if (ret < 0) {
                result = NULL;
                errno = -ret; /* We return result which is NULL in this case */
index b76ced59aa4733b969e799d1f9a78cd57669d0b2..83aeb763ec473d17385c9626d574478f1a9f457e 100644 (file)
@@ -1681,7 +1681,8 @@ int main(void) {
                                 headers='cephfs/libcephfs.h')
             conf.DEFINE('HAVE_MANDATORY_CEPH_API', '1')
             for api in ['ceph_mkdirat', 'ceph_openat', 'ceph_unlinkat',
-                        'ceph_symlinkat', 'ceph_readlinkat', 'ceph_statxat']:
+                        'ceph_symlinkat', 'ceph_readlinkat', 'ceph_statxat',
+                        'ceph_fdopendir']:
                 if not conf.CHECK_FUNCS_IN(api, 'cephfs',
                                            headers='cephfs/libcephfs.h'):
                     conf.undefine('HAVE_MANDATORY_CEPH_API')