1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

vfs_ceph: implement pathref opens in cephwrap_openat()

Ceph supports O_PATH since v0.93 from 2015:

https://ceph.io/geen-categorie/v0-93-hammer-release-candidate-released/

This seems to be old enough so we can hopefully use this without a runtime
version check.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-10-01 15:44:15 +02:00
parent cf3c48cb08
commit fd8825742f

View File

@ -407,6 +407,8 @@ static int cephwrap_openat(struct vfs_handle_struct *handle,
int flags,
mode_t mode)
{
bool have_opath = false;
bool became_root = false;
int result = -ENOENT;
/*
@ -421,8 +423,26 @@ static int cephwrap_openat(struct vfs_handle_struct *handle,
goto out;
}
#ifdef O_PATH
have_opath = true;
if (fsp->fsp_flags.is_pathref) {
flags |= O_PATH;
}
#endif
if (fsp->fsp_flags.is_pathref && !have_opath) {
become_root();
became_root = true;
}
result = ceph_open(handle->data, smb_fname->base_name, flags, mode);
if (became_root) {
unbecome_root();
}
out:
fsp->fsp_flags.have_proc_fds = false;
DBG_DEBUG("[CEPH] open(...) = %d\n", result);
WRAP_RETURN(result);
}