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

Karolin Seeger kseeger at samba.org
Tue Feb 5 23:00:02 UTC 2019


The branch, v4-10-test has been updated
       via  676b549321a s3-vfs: Use ENOATTR in errno comparison for getxattr
       via  f8773e8a78e s3-vfs: add glusterfs_fuse vfs module.
       via  a2e889740b3 selftest:Samba4: use 'smbcontrol samba shutdown'
       via  902de86daa6 s4:server: add support for 'smbcontrol samba shutdown'
       via  45c19f4c253 s4:server: avoid using pid=0 for the parent 'samba' process
       via  f105c379545 s4:messaging: add support 'smbcontrol <pid> debug/debuglevel'
       via  9d2e05b1a6d manpages/samba.7.xml: smbcontrol can also work with 'samba'
       via  520c062db5f libcli: dns: Change internal DNS_REQUEST_TIMEOUT from 2 to 10 seconds.
       via  6990f5018d9 python: dns_hub: Fix indentation of 'raise' on error.
       via  56549fd07d6 join: Throw CommandError instead of Exception for simple errors
       via  334f1e6f56a join: Fix TypeError when handling exception
       via  9ae7ffa5f05 vfs_glusterfs: Adapt to changes in libgfapi signatures
       via  94aff506747 WHATSNEW: fix typo.
       via  9859cc5c1b0 WHATSNEW: Add missing parenthesis
      from  a4466ec4282 ctdb: Print locks latency in machinereadable stats

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


- Log -----------------------------------------------------------------
commit 676b549321abe61c63cb07681bd566b05369a876
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-10-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-10-test): Tue Feb  5 23:59:06 CET 2019 on sn-devel-144

commit f8773e8a78e6dc666f9b6b49e897b1a070898113
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 a2e889740b3fa42e0287b499992366a73a3cae43
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 902de86daa685b864594df5026f60d7cd7171b2e
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 45c19f4c25393bcc9db56e93a79ac25cef7e6280
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 f105c379545ad51227126a239a60f946a2ab4a09
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 9d2e05b1a6d8872d6f059097ce5125d7f25c29aa
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 520c062db5fa67789133eaed0887367392b14fa6
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 22 09:24:35 2019 -0800

    libcli: dns: Change internal DNS_REQUEST_TIMEOUT from 2 to 10 seconds.
    
    Should make us more robust when dealing with slow DNS servers.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13750
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jan 22 23:37:16 CET 2019 on sn-devel-144
    
    (cherry picked from commit 36c42e6d629a0d4b0e5c60bdd68e08a8e60c477a)

commit 6990f5018d90ba9be680f50cc812fafc73f67d7c
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 15 08:45:26 2019 -0800

    python: dns_hub: Fix indentation of 'raise' on error.
    
    Remove second socket.sendto().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13750
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit dd231a16a338cfe63d12cadf0fc3e2ebe7cac828)

commit 56549fd07d690e8fe615f5dd291c1d798045a03b
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 334f1e6f56a10097ce918620dc484e9eb0a5b83b
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)

commit 9ae7ffa5f053c5f39691dd881d1adb290859bcad
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 94aff506747acdc98582ca6426d34a68090077d3
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 22 11:18:20 2019 +0100

    WHATSNEW: fix typo.
    
    Guenther
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13757
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit 9859cc5c1b052180435c1e11a89023726698f51c
Author: Anoop C S <anoopcs at redhat.com>
Date:   Mon Jan 21 14:24:49 2019 +0530

    WHATSNEW: Add missing parenthesis
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13757
    
    Signed-off-by: Anoop C S <anoopcs at redhat.com>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

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

Summary of changes:
 WHATSNEW.txt                                       |   4 +-
 docs-xml/manpages/samba.7.xml                      |   2 +-
 docs-xml/manpages/vfs_glusterfs_fuse.8.xml         | 103 +++++++++++++++++++++
 docs-xml/wscript_build                             |   1 +
 libcli/dns/dns.c                                   |   2 +-
 python/samba/join.py                               |   7 +-
 python/samba/netcmd/domain.py                      |   2 +-
 .../samba/tests/dns_forwarder_helpers/dns_hub.py   |   4 +-
 selftest/target/Samba4.pm                          |   9 ++
 source3/modules/posixacl_xattr.c                   |   4 +-
 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                              |  39 +++++++-
 16 files changed, 337 insertions(+), 16 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/WHATSNEW.txt b/WHATSNEW.txt
index 493d9c2b35f..bed631c5eaa 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -94,7 +94,7 @@ e.g. '--extra-python=/usr/bin/python2'. It should be noted that support for
 this option will be deprecated in a future release.
 
 What if I need to build with python2? To build with python2 you *must* set
-the 'PYTHON' environent variable to override the python3 default for both
+the 'PYTHON' environment variable to override the python3 default for both
 'configure' and 'make' steps.
 
    'PYTHON=python2 ./configure.developer'
@@ -103,7 +103,7 @@ the 'PYTHON' environent variable to override the python3 default for both
 
 Note: Support for python2 (with the exception of a build configured with
       'PYTHON=python2 ./configure --disable-python' and built with
-      'PYTHON=python2 make' will be deprecated in the next release.
+      'PYTHON=python2 make') will be deprecated in the next release.
 
 JSON logging
 ------------
diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml
index 5b72d659871..836ed23619f 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 1b4335cbb5d..86600ae4a82 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -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',
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index 1321b1d2d38..718bf56b3bd 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -39,7 +39,7 @@ struct dns_udp_request_state {
 	size_t reply_len;
 };
 
-#define DNS_REQUEST_TIMEOUT 2
+#define DNS_REQUEST_TIMEOUT 10
 
 /* Declare callback functions used below. */
 static void dns_udp_request_get_reply(struct tevent_req *subreq);
diff --git a/python/samba/join.py b/python/samba/join.py
index cf5d1b92b66..da8dcb050d3 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -50,6 +50,7 @@ import os
 import tempfile
 from samba.compat import text_type
 from samba.compat import get_string
+from samba.netcmd import CommandError
 
 
 class DCJoinException(Exception):
@@ -345,10 +346,10 @@ class DCJoinContext(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 9c5ae21fdd7..b7aedc16a91 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -1802,7 +1802,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/python/samba/tests/dns_forwarder_helpers/dns_hub.py b/python/samba/tests/dns_forwarder_helpers/dns_hub.py
index 81aa478f4ba..cf9beb7fa7a 100755
--- a/python/samba/tests/dns_forwarder_helpers/dns_hub.py
+++ b/python/samba/tests/dns_forwarder_helpers/dns_hub.py
@@ -123,9 +123,7 @@ class DnsHandler(sserver.BaseRequestHandler):
         except socket.error as err:
             print("Error sending %s to address %s for name %s: %s\n" %
                 (forwarder, self.client_address, name, err.errno))
-        raise
-
-        socket.sendto(send_packet, self.client_address)
+            raise
 
 class server_thread(threading.Thread):
     def __init__(self, server):
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index f2635e574cd..b662776a847 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -2221,6 +2221,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_glusterfs.c b/source3/modules/vfs_glusterfs.c
index c9d57b4b646..601be5a2da4 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -633,7 +633,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;
@@ -664,7 +668,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;
@@ -954,7 +965,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,
@@ -1239,7 +1254,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,
@@ -1443,7 +1462,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 db083f50646..4a51002182f 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -515,6 +515,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 24e52e592c9..17331a1aa50 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1570,6 +1570,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')
@@ -1661,6 +1664,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 6c10289515f..6cf58539a75 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);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list