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

Karolin Seeger kseeger at samba.org
Tue Feb 5 18:14:02 UTC 2019


The branch, v4-9-test has been updated
       via  9b21b518d72 s3-vfs: Use ENOATTR in errno comparison for getxattr
       via  676b43893d7 s3-vfs: add glusterfs_fuse vfs module.
       via  d94e82305e6 selftest:Samba4: use 'smbcontrol samba shutdown'
       via  aced074c363 s4:server: add support for 'smbcontrol samba shutdown'
       via  e896ca8f9c5 s4:server: avoid using pid=0 for the parent 'samba' process
       via  562ceb1f43d s4:messaging: add support 'smbcontrol <pid> debug/debuglevel'
       via  f6ebd9d2a9e manpages/samba.7.xml: smbcontrol can also work with 'samba'
       via  56b401ebd38 join: Throw CommandError instead of Exception for simple errors
       via  e51de1d48a4 join: Fix TypeError when handling exception
       via  3477e19d742 vfs_glusterfs: Adapt to changes in libgfapi signatures
       via  6ddc44fbb7a vfs_fileid: fix fsname_norootdir algorithm
      from  d1428435b52 ctdb: Print locks latency in machinereadable stats

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


- Log -----------------------------------------------------------------
commit 9b21b518d7264cb1e1fddfeea440fb70d0bc8e50
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-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Tue Feb  5 19:13:57 CET 2019 on sn-devel-144

commit 676b43893d7a5ff1f935e1db633878bc7cc6bfb6
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 d94e82305e63615edcceee1095a8442012fb12ae
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 aced074c3635408962d52d8d488d4bee759b24b5
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 e896ca8f9c5d6f8f0500944dc8ceea9a8dcdabb5
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 562ceb1f43da0e7fd640bb7a8d5eb65a92ea2e89
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 f6ebd9d2a9eb135c51cbea5909f54b61196ecef4
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 56b401ebd38c8c498f5df11fe7119be0204c940b
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 e51de1d48a4656d08d1276477fe48cb7c9a15603
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 3477e19d742e08c946c565f1f9c30e5db16d1c15
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 6ddc44fbb7a1c432a31908b8f11c5553c5a42a10
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                       |   7 +-
 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                      |  39 ++++++++++-
 14 files changed, 335 insertions(+), 11 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 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 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 3b648f50090..36a854711ff 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -46,6 +46,7 @@ import time
 import re
 import os
 import tempfile
+from samba.netcmd import CommandError
 
 class DCJoinException(Exception):
 
@@ -337,10 +338,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 1d34d0620eb..f9dc08fab64 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -1818,7 +1818,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 a21ada84eb2..b565d466477 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -2033,6 +2033,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 e32456f60b3..fc2ea2addeb 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -628,7 +628,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;
@@ -659,7 +663,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;
@@ -958,7 +969,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,
@@ -1243,7 +1258,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,
@@ -1447,7 +1466,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 21ec90944f2..238b55549a8 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -499,6 +499,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 31bd7333bdd..47b55122081 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1568,6 +1568,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')
@@ -1659,6 +1662,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 935951f3fba..4a71b2b76bb 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 @@ static struct imessaging_context *imessaging_init_internal(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;
+	}
+	status = imessaging_register(msg, NULL, MSG_REQ_DEBUGLEVEL,
+				     debuglevel_imessage);
+	if (!NT_STATUS_IS_OK(status)) {
+		goto fail;
+	}
 	status = IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg);
 	if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list