[SCM] Samba Shared Repository - branch v4-8-test updated

Karolin Seeger kseeger at samba.org
Tue Feb 5 19:32:02 UTC 2019


The branch, v4-8-test has been updated
       via  1be33edc670 s3-vfs: Use ENOATTR in errno comparison for getxattr
       via  3db3eff3120 s3-vfs: add glusterfs_fuse vfs module.
       via  10360077122 selftest:Samba4: use 'smbcontrol samba shutdown'
       via  37b9360c714 s4:server: add support for 'smbcontrol samba shutdown'
       via  676a2fcfdf0 s4:server: avoid using pid=0 for the parent 'samba' process
       via  121348d4a56 s4:messaging: add support 'smbcontrol <pid> debug/debuglevel'
       via  39abec8db34 manpages/samba.7.xml: smbcontrol can also work with 'samba'
       via  72e45c8841d join: Throw CommandError instead of Exception for simple errors
       via  7acef6b7f43 join: Fix TypeError when handling exception
       via  244bd50e364 vfs_glusterfs: Adapt to changes in libgfapi signatures
       via  b5bc51a7511 vfs_fileid: fix fsname_norootdir algorithm
      from  c56beb9a1fd vfs_fileid: fix get_connectpath_ino

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-8-test


- Log -----------------------------------------------------------------
commit 1be33edc670f26fc77bef45fa7275d524d54fd59
Author: Anoop C S <anoopcs at redhat.com>
Date:   Wed Jan 23 15:40:43 2019 +0530

    s3-vfs: Use ENOATTR in errno comparison for getxattr
    
    * ENODATA is not defined in FreeBSD
    * ENOATTR is defined to be a synonym for ENODATA in Linux
    * In its absence Samba already defines ENOATTR to either
      ENODATA or ENOENT
    
    Thus it is safe and correct to compare with ENOATTR rather
    than ENODATA.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13774
    
    Signed-off-by: Anoop C S <anoopcs at redhat.com>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Jan 23 21:59:10 CET 2019 on sn-devel-144
    
    (cherry picked from commit c99402724a65f4e1f8ed4dcd236a43e0603bef0a)
    
    Autobuild-User(v4-8-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-8-test): Tue Feb  5 20:31:37 CET 2019 on sn-devel-144

commit 3db3eff31200022106f417c26c4d23f4870d07ab
Author: Günther Deschner <gd at samba.org>
Date:   Thu Jan 17 15:21:07 2019 +0100

    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 at redhat.com>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13774
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Tue Jan 22 18:37:56 CET 2019 on sn-devel-144
    
    (cherry picked from commit adffe0dcf002aa4721dc7897261895e3486d5271)

commit 103600771227e074b46038f1bbb5a345c786d0b9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 17 23:50:45 2019 +0100

    selftest:Samba4: use 'smbcontrol samba shutdown'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Jan 30 01:51:48 CET 2019 on sn-devel-144
    
    (cherry picked from commit d03991f569b54ae0a11911b622107fbae701715d)

commit 37b9360c714f1913e5107a5882d551bc35a20b24
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 17 16:27:10 2019 +0100

    s4:server: add support for 'smbcontrol samba shutdown'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
    (cherry picked from commit 832776c0fcf7cc658c128765514755c2d15b06a6)

commit 676a2fcfdf043cee82a47c8b340671c351e5e75c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jan 28 16:29:51 2019 +0100

    s4:server: avoid using pid=0 for the parent 'samba' process
    
    It confuses the 'samba-tool processes' output and log messages.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
    (cherry picked from commit 5bd7a8e5685caa09067745b108ef7e53e3108e97)

commit 121348d4a560e925d1355a1cf4a9db39b25b2d9d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 15 01:39:06 2019 +0100

    s4:messaging: add support 'smbcontrol <pid> debug/debuglevel'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
    (cherry picked from commit 3a0c1da432c53de234b54bac90a3fb84534994eb)

commit 39abec8db3485ac603565fedf6a4d11bf2eb276b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 17 16:29:37 2019 +0100

    manpages/samba.7.xml: smbcontrol can also work with 'samba'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
    (cherry picked from commit 12b9adec3ff48f4356f9ff865891dc3c652ff86b)

commit 72e45c8841deae94793ab0e705fcf590e9723fa5
Author: Tim Beale <timbeale at catalyst.net.nz>
Date:   Wed Jan 16 15:37:00 2019 +1300

    join: Throw CommandError instead of Exception for simple errors
    
    Throwing an exception here still dumps out the Python stack trace, which
    can be a little disconcerting for users.
    
    In this case, the stack trace isn't going to really help at all (the
    problem is pretty obvious), and it obscures the useful message
    explaining what went wrong.
    
    Throw a CommandError instead, which samba-tool will catch and display
    more nicely.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13747
    
    Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
    Reviewed-by: Rowland Penny <rpenny at samba.org>
    Reviewed-by: Jeremy Allison <rpenny at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Jan 16 22:11:04 CET 2019 on sn-devel-144
    
    (cherry picked from commit 9e4b08f4c384b8cae5ad853a7be7cf03e2749be5)

commit 7acef6b7f43e6d82136bd5c80c782eb6713f280b
Author: Tim Beale <timbeale at catalyst.net.nz>
Date:   Wed Jan 16 15:17:38 2019 +1300

    join: Fix TypeError when handling exception
    
    When we can't resolve a domain name, we were inadvertently throwing a
    TypeError whilst trying to output a helpful message. E.g.
    
    ERROR(<class 'TypeError'>): uncaught exception - 'NTSTATUSError' object
    does not support indexing
    
    Instead of indexing the object, we want to index the Exception.args so
    that we just display the string portion of the exception error.
    
    The same problem is also present for the domain trust commands.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13747
    
    Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
    Reviewed-by: Rowland Penny <rpenny at samba.org>
    Reviewed-by: Jeremy Allison <rpenny at samba.org>
    (cherry picked from commit 3bb7808984c163a7bba66fb983411d1281589722
    and modified to work for 4.8 - note that the NTSTATUSError exception
    wasn't even imported on 4.8)

commit 244bd50e3643388cb15256b5b58b68b990fb3f69
Author: Anoop C S <anoopcs at redhat.com>
Date:   Tue Mar 20 11:32:20 2018 +0530

    vfs_glusterfs: Adapt to changes in libgfapi signatures
    
    VFS module for GlusterFS fails to compile due to recent changes done to
    some API signatures. Therefore adding missing arguments to those APIs
    adapting to new signatures.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13330
    
    Signed-off-by: Anoop C S <anoopcs at redhat.com>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sun Feb  3 17:00:33 CET 2019 on sn-devel-144
    
    (cherry picked from commit 0e3eda5bab5ae9316a42725aea048fb350020ec7)

commit b5bc51a75113a79aa5d85605f51e546aa120ecf7
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Tue Jan 15 09:55:50 2019 +0100

    vfs_fileid: fix fsname_norootdir algorithm
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13744
    
    Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Jan 17 01:36:54 CET 2019 on sn-devel-144
    
    (cherry picked from commit 2723d900ef35f4797058675f298f4a4364b29cd3)

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages/samba.7.xml              |   2 +-
 docs-xml/manpages/vfs_glusterfs_fuse.8.xml | 103 +++++++++++++++++++++++++++++
 docs-xml/wscript_build                     |   1 +
 python/samba/join.py                       |   9 +--
 python/samba/netcmd/domain.py              |   2 +-
 selftest/target/Samba4.pm                  |   9 +++
 source3/modules/posixacl_xattr.c           |   4 +-
 source3/modules/vfs_fileid.c               |   3 +-
 source3/modules/vfs_glusterfs.c            |  21 +++++-
 source3/modules/vfs_glusterfs_fuse.c       |  71 ++++++++++++++++++++
 source3/modules/wscript_build              |   8 +++
 source3/wscript                            |   4 ++
 source4/lib/messaging/messaging.c          |  72 ++++++++++++++++++++
 source4/smbd/server.c                      |  40 ++++++++++-
 14 files changed, 337 insertions(+), 12 deletions(-)
 create mode 100644 docs-xml/manpages/vfs_glusterfs_fuse.8.xml
 create mode 100644 source3/modules/vfs_glusterfs_fuse.c


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml
index 761c8d3c65a..750a718185b 100644
--- a/docs-xml/manpages/samba.7.xml
+++ b/docs-xml/manpages/samba.7.xml
@@ -166,7 +166,7 @@
 		<manvolnum>1</manvolnum></citerefentry></term>
 		<listitem><para><command>smbcontrol</command> is a utility
 		that can change the behaviour of running
-		<command>smbd</command>, <command>nmbd</command> and
+		<command>samba</command>, <command>smbd</command>, <command>nmbd</command> and
 		<command>winbindd</command> daemons.
 		</para></listitem>
 		</varlistentry>
diff --git a/docs-xml/manpages/vfs_glusterfs_fuse.8.xml b/docs-xml/manpages/vfs_glusterfs_fuse.8.xml
new file mode 100644
index 00000000000..b9f7f42c6f2
--- /dev/null
+++ b/docs-xml/manpages/vfs_glusterfs_fuse.8.xml
@@ -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>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index ec5d28fc62a..d0edfdbed2c 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -69,6 +69,7 @@ manpages='''
          manpages/vfs_fruit.8
          manpages/vfs_full_audit.8
          manpages/vfs_glusterfs.8
+         manpages/vfs_glusterfs_fuse.8
          manpages/vfs_gpfs.8
          manpages/vfs_linux_xfs_sgid.8
          manpages/vfs_media_harmony.8
diff --git a/python/samba/join.py b/python/samba/join.py
index 9782f536dce..d577df07069 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -35,13 +35,14 @@ from samba.provision.sambadns import setup_bind9_dns
 from samba import read_and_sub_file
 from samba import werror
 from base64 import b64encode
-from samba import WERRORError
+from samba import WERRORError, NTSTATUSError
 from samba.dnsserver import ARecord, AAAARecord, PTRRecord, CNameRecord, NSRecord, MXRecord, SOARecord, SRVRecord, TXTRecord
 from samba import sd_utils
 import logging
 import talloc
 import random
 import time
+from samba.netcmd import CommandError
 
 class DCJoinException(Exception):
 
@@ -337,10 +338,10 @@ class dc_join(object):
         try:
             ctx.cldap_ret = ctx.net.finddc(domain=domain, flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
         except NTSTATUSError as error:
-            raise Exception("Failed to find a writeable DC for domain '%s': %s" %
-                            (domain, error[1]))
+            raise CommandError("Failed to find a writeable DC for domain '%s': %s" %
+                               (domain, error.args[1]))
         except Exception:
-            raise Exception("Failed to find a writeable DC for domain '%s'" % domain)
+            raise CommandError("Failed to find a writeable DC for domain '%s'" % domain)
         if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site != "":
             ctx.site = ctx.cldap_ret.client_site
         return ctx.cldap_ret.pdc_dns_name
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 38c800c711b..2901605ce29 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -1773,7 +1773,7 @@ class DomainTrustCommand(Command):
             remote_info = remote_net.finddc(flags=remote_flags, domain=domain, address=remote_server)
         except NTSTATUSError as error:
             raise CommandError("Failed to find a writeable DC for domain '%s': %s" %
-                               (domain, error[1]))
+                               (domain, error.args[1]))
         except Exception:
             raise CommandError("Failed to find a writeable DC for domain '%s'" % domain)
         flag_map = {
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index d6d67f5a5ab..264eaf35007 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -1982,6 +1982,15 @@ sub teardown_env_terminate($$)
 	my ($self, $envvars) = @_;
 	my $pid;
 
+	# This should cause samba to terminate gracefully
+	my $smbcontrol = Samba::bindir_path($self, "smbcontrol");
+	my $cmd = "";
+	$cmd .= "$smbcontrol samba shutdown $envvars->{CONFIGURATION}";
+	my $ret = system($cmd);
+	if ($ret != 0) {
+		warn "'$cmd' failed with '$ret'\n";
+	}
+
 	# This should cause samba to terminate gracefully
 	close($envvars->{STDIN_PIPE});
 
diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c
index 8f6f365bff9..6f016e17e0b 100644
--- a/source3/modules/posixacl_xattr.c
+++ b/source3/modules/posixacl_xattr.c
@@ -379,7 +379,7 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
 	if (ret > 0) {
 		return posixacl_xattr_to_smb_acl(buf, ret, mem_ctx);
 	}
-	if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
+	if (ret == 0 || errno == ENOATTR) {
 		mode_t mode = 0;
 		TALLOC_CTX *frame = talloc_stackframe();
 		struct smb_filename *smb_fname_tmp =
@@ -434,7 +434,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle,
 	if (ret > 0) {
 		return posixacl_xattr_to_smb_acl(buf, ret, mem_ctx);
 	}
-	if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
+	if (ret == 0 || errno == ENOATTR) {
 		SMB_STRUCT_STAT sbuf;
 		ret = SMB_VFS_FSTAT(fsp, &sbuf);
 		if (ret == 0)
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index cb77a2e52c6..cd6f9c30cf3 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -456,7 +456,8 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
 				struct fileid_handle_data,
 				return id);
 
-	if ((data->nolockinode != 0) && (id.inode == data->nolockinode)) {
+	if ((data->nolockinode != 0) &&
+	    (sbuf->st_ex_ino == data->nolockinode)) {
 		devid = fileid_device_mapping_hostname(data, sbuf);
 	} else {
 		devid = data->device_mapping_fn(data, sbuf);
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index e6448cc874a..7d407a21b31 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -640,7 +640,11 @@ static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
+#ifdef HAVE_GFAPI_VER_7_6
+	return glfs_pread(glfd, data, n, offset, 0, NULL);
+#else
 	return glfs_pread(glfd, data, n, offset, 0);
+#endif
 }
 
 struct glusterfs_aio_state;
@@ -671,7 +675,14 @@ static int aio_wrapper_destructor(struct glusterfs_aio_wrapper *wrap)
  * threads once the async IO submitted is complete. To notify
  * Samba of the completion we use a pipe based queue.
  */
+#ifdef HAVE_GFAPI_VER_7_6
+static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret,
+			       struct glfs_stat *prestat,
+			       struct glfs_stat *poststat,
+			       void *data)
+#else
 static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, void *data)
+#endif
 {
 	struct glusterfs_aio_state *state = NULL;
 	int sts = 0;
@@ -957,7 +968,11 @@ static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
+#ifdef HAVE_GFAPI_VER_7_6
+	return glfs_pwrite(glfd, data, n, offset, 0, NULL, NULL);
+#else
 	return glfs_pwrite(glfd, data, n, offset, 0);
+#endif
 }
 
 static off_t vfs_gluster_lseek(struct vfs_handle_struct *handle,
@@ -1246,7 +1261,11 @@ static int vfs_gluster_ftruncate(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
+#ifdef HAVE_GFAPI_VER_7_6
+	return glfs_ftruncate(glfd, offset, NULL, NULL);
+#else
 	return glfs_ftruncate(glfd, offset);
+#endif
 }
 
 static int vfs_gluster_fallocate(struct vfs_handle_struct *handle,
@@ -1450,7 +1469,7 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
 
 	ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
 	if (ret == -1) {
-		if (errno == ENODATA) {
+		if (errno == ENOATTR) {
 			errno = EOPNOTSUPP;
 		}
 		return -1;
diff --git a/source3/modules/vfs_glusterfs_fuse.c b/source3/modules/vfs_glusterfs_fuse.c
new file mode 100644
index 00000000000..8855cd18d01
--- /dev/null
+++ b/source3/modules/vfs_glusterfs_fuse.c
@@ -0,0 +1,71 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (c) 2019 Guenther Deschner <gd at 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 == ENOATTR) {
+			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);
+}
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index 1f9730b5347..23cfa3050d5 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -494,6 +494,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',
diff --git a/source3/wscript b/source3/wscript
index 5a8f912453e..3b081bc2c79 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1581,6 +1581,9 @@ main() {
         conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 6" --cflags --libs',
                        msg='Checking for glusterfs-api >= 6',
                        uselib_store="GFAPI_VER_6")
+        conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.6" --cflags --libs',
+                       msg='Checking for glusterfs-api >= 7.6',
+                       uselib_store="GFAPI_VER_7_6")
     else:
         conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
         conf.undefine('HAVE_GLUSTERFS')
@@ -1672,6 +1675,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
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index b8d4e50f12c..85be5baf258 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -121,6 +121,68 @@ static void ringbuf_log_msg(struct imessaging_context *msg,
 	imessaging_send(msg, src, MSG_RINGBUF_LOG, &blob);
 }
 
+/****************************************************************************
+ Receive a "set debug level" message.
+****************************************************************************/
+
+static void debug_imessage(struct imessaging_context *msg_ctx,
+			   void *private_data,
+			   uint32_t msg_type,
+			   struct server_id src,
+			   DATA_BLOB *data)
+{
+	const char *params_str = (const char *)data->data;
+	struct server_id_buf src_buf;
+	struct server_id dst = imessaging_get_server_id(msg_ctx);
+	struct server_id_buf dst_buf;
+
+	/* Check, it's a proper string! */
+	if (params_str[(data->length)-1] != '\0') {
+		DBG_ERR("Invalid debug message from pid %s to pid %s\n",
+			server_id_str_buf(src, &src_buf),
+			server_id_str_buf(dst, &dst_buf));
+		return;
+	}
+
+	DBG_ERR("INFO: Remote set of debug to `%s' (pid %s from pid %s)\n",
+		params_str,
+		server_id_str_buf(dst, &dst_buf),
+		server_id_str_buf(src, &src_buf));
+
+	debug_parse_levels(params_str);
+}
+
+/****************************************************************************
+ Return current debug level.
+****************************************************************************/
+
+static void debuglevel_imessage(struct imessaging_context *msg_ctx,
+				void *private_data,
+				uint32_t msg_type,
+				struct server_id src,
+				DATA_BLOB *data)
+{
+	char *message = debug_list_class_names_and_levels();
+	DATA_BLOB blob = data_blob_null;
+	struct server_id_buf src_buf;
+	struct server_id dst = imessaging_get_server_id(msg_ctx);
+	struct server_id_buf dst_buf;
+
+	DBG_DEBUG("Received REQ_DEBUGLEVEL message (pid %s from pid %s)\n",
+		  server_id_str_buf(dst, &dst_buf),
+		  server_id_str_buf(src, &src_buf));
+
+	if (message == NULL) {
+		DBG_ERR("debug_list_class_names_and_levels returned NULL\n");
+		return;
+	}
+
+	blob = data_blob_string_const_null(message);
+	imessaging_send(msg_ctx, src, MSG_DEBUGLEVEL, &blob);
+
+	TALLOC_FREE(message);
+}
+
 /*
   return uptime of messaging server via irpc
 */
@@ -418,6 +480,16 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
 	if (!NT_STATUS_IS_OK(status)) {
 		goto fail;
 	}
+	status = imessaging_register(msg, NULL, MSG_DEBUG,
+				     debug_imessage);
+	if (!NT_STATUS_IS_OK(status)) {
+		goto fail;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list