From c8116aeb4d4891d05795ccd0ab9c98804ae35968 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 5 Oct 2020 12:28:27 +0200 Subject: [PATCH] Revert "vfs_ceph: drop fdopendir handler" This reverts commit 76d7d05b1da6c0703b1c2bade0c4467c7cc1adec. OpenDir_fsp() no longer falls back to regular open, so this hook is required. Bug: https://bugzilla.samba.org/show_bug.cgi?id=14519 Signed-off-by: David Disseldorp Reviewed-by: Samuel Cabrero Autobuild-User(master): David Disseldorp Autobuild-Date(master): Mon Oct 5 12:38:34 UTC 2020 on sn-devel-184 (cherry picked from commit 83ab59d929a6319c18341cb69d5084b563fb59bb) --- source3/modules/vfs_ceph.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 0378d633782..a87d162e573 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -306,9 +306,18 @@ static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle, const char *mask, uint32_t attributes) { - /* OpenDir_fsp() falls back to regular open */ - errno = ENOSYS; - return NULL; + int ret = 0; + struct ceph_dir_result *result; + DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp); + + ret = ceph_opendir(handle->data, fsp->fsp_name->base_name, &result); + if (ret < 0) { + result = NULL; + errno = -ret; /* We return result which is NULL in this case */ + } + + DBG_DEBUG("[CEPH] fdopendir(...) = %d\n", ret); + return (DIR *) result; } static struct dirent *cephwrap_readdir(struct vfs_handle_struct *handle, -- 2.26.2