From 7d1e6e83d8a5565f84d3ab72df21d9beb83c081d Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 1 Oct 2020 15:44:15 +0200 Subject: [PATCH] vfs_glusterfs: implement pathref opens with become_root() fallback Until glusterfs supports O_PATH, fallback to become_root(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/modules/vfs_glusterfs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 1d636471812..e4c12931938 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -729,6 +729,7 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, int flags, mode_t mode) { + bool became_root = false; glfs_fd_t *glfd; glfs_fd_t **p_tmp; @@ -746,6 +747,15 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, return -1; } + if (fsp->fsp_flags.is_pathref) { + /* + * ceph doesn't support O_PATH so we have to fallback to + * become_root(). + */ + become_root(); + became_root = true; + } + if (flags & O_DIRECTORY) { glfd = glfs_opendir(handle->data, smb_fname->base_name); } else if (flags & O_CREAT) { @@ -755,6 +765,12 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, glfd = glfs_open(handle->data, smb_fname->base_name, flags); } + if (became_root) { + unbecome_root(); + } + + fsp->fsp_flags.have_proc_fds = false; + if (glfd == NULL) { END_PROFILE(syscall_openat); /* no extension destroy_fn, so no need to save errno */ -- 2.47.3