1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s3-vfs: add glusterfs_fuse vfs module.

This module only implements the get_real_filename function by accessing
a distinct extended attribute that is available over a glusterfs fuse
mount.

By implementing this vfs function users of a glusterfs fuse mount
achieve a much better performance in create based workloads where samba
then can avoid trying multiple case folding options to detect the real
filename.

Patch is based on an initial patch provided by
Poornima G <pgurusid@redhat.com>

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jan 22 18:37:56 CET 2019 on sn-devel-144
This commit is contained in:
Günther Deschner 2019-01-17 15:21:07 +01:00
parent 10e54a095f
commit adffe0dcf0
5 changed files with 184 additions and 0 deletions

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
<refentry id="vfs_glusterfs_fuse.8">
<refmeta>
<refentrytitle>vfs_glusterfs_fuse</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="source">Samba</refmiscinfo>
<refmiscinfo class="manual">System Administration tools</refmiscinfo>
<refmiscinfo class="version">&doc.version;</refmiscinfo>
</refmeta>
<refnamediv>
<refname>vfs_glusterfs_fuse</refname>
<refpurpose>
Utilize features provided by GlusterFS
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>vfs objects = glusterfs_fuse</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<para>This VFS module is part of the
<citerefentry><refentrytitle>samba</refentrytitle>
<manvolnum>8</manvolnum></citerefentry> suite.</para>
<para>
GlusterFS
(<ulink url="http://www.gluster.org/">http://www.gluster.org</ulink>)
is an Open Source clustered file system capable of scaling to
several peta-bytes. With its FUSE based native client,
GlusterFS is available as a POSIX compliant file system and can
hence be shared by Samba without additional steps.
</para>
<para>
The <command>vfs_glusterfs_fuse</command> VFS module provides an enhanced way
to access a Gluster filesystem using a Gluster FUSE mount. It provides support
for the <command>get_real_filename</command> VFS call which enhances file access performance
by avoiding multiple expensive case folding lookup calls to detect the appropriate
case of an exisiting filename.
</para>
<para>
This module can be combined with other modules, but it
should be the last module in the <command>vfs objects</command>
list. Modules added to this list to the right of the glusterfs
entry may not have any effect at all.
</para>
</refsect1>
<refsect1>
<title>CONFIGURATION</title>
<para>
A basic configuration looks like this.
</para>
<programlisting>
<smbconfsection name="[share]"/>
<smbconfoption name="vfs objects">glusterfs_fuse</smbconfoption>
<smbconfoption name="path">/absolute/path_of_fusemount</smbconfoption>
</programlisting>
<para>
Note that <command>vfs_glusterfs_fuse</command> requires a Gluster mount. For accessing glusterfs directly
over the GFAPI library please use the <command>vfs_glusterfs</command> module.
</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<para>
This module does currently have no further options.
</para>
</refsect1>
<refsect1>
<title>VERSION</title>
<para>
This man page is part of version &doc.version; of the Samba suite.
</para>
</refsect1>
<refsect1>
<title>AUTHOR</title>
<para>The original Samba software and related utilities
were created by Andrew Tridgell. Samba is now developed
by the Samba Team as an Open Source project similar
to the way the Linux kernel is developed.</para>
</refsect1>
</refentry>

View File

@ -82,6 +82,7 @@ vfs_module_manpages = ['vfs_acl_tdb',
'vfs_fruit',
'vfs_full_audit',
'vfs_glusterfs',
'vfs_glusterfs_fuse',
'vfs_gpfs',
'vfs_linux_xfs_sgid',
'vfs_media_harmony',

View File

@ -0,0 +1,71 @@
/*
Unix SMB/CIFS implementation.
Copyright (c) 2019 Guenther Deschner <gd@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "smbd/smbd.h"
#include "system/filesys.h"
static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
const char *path,
const char *name,
TALLOC_CTX *mem_ctx,
char **_found_name)
{
int ret;
char key_buf[NAME_MAX + 64];
char val_buf[NAME_MAX + 1];
char *found_name = NULL;
if (strlen(name) >= NAME_MAX) {
errno = ENAMETOOLONG;
return -1;
}
snprintf(key_buf, NAME_MAX + 64,
"glusterfs.get_real_filename:%s", name);
ret = getxattr(path, key_buf, val_buf, NAME_MAX + 1);
if (ret == -1) {
if (errno == ENODATA) {
errno = EOPNOTSUPP;
}
return -1;
}
found_name = talloc_strdup(mem_ctx, val_buf);
if (found_name == NULL) {
errno = ENOMEM;
return -1;
}
*_found_name = found_name;
return 0;
}
struct vfs_fn_pointers glusterfs_fuse_fns = {
/* File Operations */
.get_real_filename_fn = vfs_gluster_fuse_get_real_filename,
};
static_decl_vfs;
NTSTATUS vfs_glusterfs_fuse_init(TALLOC_CTX *ctx)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
"glusterfs_fuse", &glusterfs_fuse_fns);
}

View File

@ -514,6 +514,14 @@ bld.SAMBA3_MODULE('vfs_glusterfs',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_glusterfs'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_glusterfs'))
bld.SAMBA3_MODULE('vfs_glusterfs_fuse',
subsystem='vfs',
source='vfs_glusterfs_fuse.c',
deps='',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_glusterfs_fuse'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_glusterfs_fuse'))
bld.SAMBA3_MODULE('vfs_worm',
subsystem='vfs',
source='vfs_worm.c',

View File

@ -1661,6 +1661,7 @@ main() {
vfs_media_harmony vfs_unityed_media vfs_fruit vfs_shell_snap
vfs_commit vfs_worm vfs_crossrename vfs_linux_xfs_sgid
vfs_time_audit vfs_offline vfs_virusfilter
vfs_glusterfs_fuse
'''))
default_shared_modules.extend(TO_LIST('auth_script idmap_tdb2 idmap_script'))
# these have broken dependencies