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

Karolin Seeger kseeger at samba.org
Tue Nov 3 13:03:02 UTC 2020


The branch, v4-12-test has been updated
       via  5d78ec76c86 s3: modules: vfs_glusterfs: Fix leak of char **lines onto mem_ctx on return.
       via  329c95136ff s3-vfs_glusterfs: refuse connection when write-behind xlator is present
       via  00040999380 docs-xml/manpages: Add warning about write-behind translator for vfs_glusterfs
      from  7e955ca5cf9 ctdb-common: Avoid aliasing errors during code optimization

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


- Log -----------------------------------------------------------------
commit 5d78ec76c86634faabda04d356790f66c82dd21c
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 2 15:46:51 2020 -0800

    s3: modules: vfs_glusterfs: Fix leak of char **lines onto mem_ctx on return.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Nov  3 01:56:59 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 7d846cd178d653600c71ee4bd6a491a9e48a56da)
    
    Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-12-test): Tue Nov  3 13:02:10 UTC 2020 on sn-devel-184

commit 329c95136ff82a398856fef174d4b3c899c8fcc8
Author: Günther Deschner <gd at samba.org>
Date:   Mon Nov 2 12:30:36 2020 +0100

    s3-vfs_glusterfs: refuse connection when write-behind xlator is present
    
    s3-vfs_glusterfs: refuse connection when write-behind xlator is present
    
    Once the new glusterfs api is available we will programmtically disable
    the translator, for now we just refuse the connection as there is
    a potential for serious data damage.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Pair-Programmed-With: Sachin Prabhu <sprabhu at redhat.com>
    Pair-Programmed-With: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Nov  2 21:40:33 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 2a49ccbcf5e3ff0f6833bcb7f04b800125f1783f)

commit 0004099938068db5c81628a6a2b077807218dd86
Author: Sachin Prabhu <sprabhu at redhat.com>
Date:   Thu Oct 15 12:14:33 2020 +0100

    docs-xml/manpages: Add warning about write-behind translator for vfs_glusterfs
    
    Add warning about data corruption with the write-behind translator.
    
    The data corruption is highlighted by the smbtorture test smb2.rw.rw1.
    More information about this data corruption issue is available in the
    bz.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
    
    Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 08f8f665d409ee7b93840c25a8142f2ce8bacfa1)

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

Summary of changes:
 docs-xml/manpages/vfs_glusterfs.8.xml | 22 +++++++++
 source3/modules/vfs_glusterfs.c       | 91 +++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index cf3b8e5e384..7a4da1af919 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -161,6 +161,28 @@
 
 </refsect1>
 
+<refsect1>
+	<title>CAVEATS</title>
+
+	<para>
+                The GlusterFS write-behind performance translator, when used
+                with Samba, could be a source of data corruption. The
+                translator, while processing a write call, immediately returns
+                success but continues writing the data to the server in the
+                background. This can cause data corruption when two clients
+                relying on Samba to provide data consistency are operating on
+                the same file.
+        </para>
+        <para>
+                The write-behind translator is enabled by default on GlusterFS.
+                The vfs_glusterfs plugin will check for the presence of the
+                translator and refuse to connect if detected.
+                Please disable the write-behind translator for the GlusterFS
+                volume to allow the plugin to connect to the volume.
+	</para>
+</refsect1>
+
+
 <refsect1>
 	<title>VERSION</title>
 
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index d4b68fba376..b733adfff5c 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -264,6 +264,92 @@ out:
 
 /* Disk Operations */
 
+static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
+					     glfs_t *fs,
+					     const char *volume)
+{
+	char *buf = NULL;
+	char **lines = NULL;
+	int numlines = 0;
+	int i;
+	char *option;
+	bool write_behind_present = false;
+	size_t newlen;
+	int ret;
+
+	ret = glfs_get_volfile(fs, NULL, 0);
+	if (ret == 0) {
+		DBG_ERR("%s: Failed to get volfile for "
+			"volume (%s): No volfile\n",
+			volume,
+			strerror(errno));
+		return -1;
+	}
+	if (ret > 0) {
+		DBG_ERR("%s: Invalid return %d for glfs_get_volfile for "
+			"volume (%s): No volfile\n",
+			volume,
+			ret,
+			strerror(errno));
+		return -1;
+	}
+
+	newlen = 0 - ret;
+
+	buf = talloc_zero_array(mem_ctx, char, newlen);
+	if (buf == NULL) {
+		return -1;
+	}
+
+	ret = glfs_get_volfile(fs, buf, newlen);
+	if (ret != newlen) {
+		TALLOC_FREE(buf);
+		DBG_ERR("%s: Failed to get volfile for volume (%s)\n",
+			volume, strerror(errno));
+		return -1;
+	}
+
+	option = talloc_asprintf(mem_ctx, "volume %s-write-behind", volume);
+	if (option == NULL) {
+		TALLOC_FREE(buf);
+		return -1;
+	}
+
+	lines = file_lines_parse(buf,
+				newlen,
+				&numlines,
+				mem_ctx);
+	if (lines == NULL || numlines <= 0) {
+		TALLOC_FREE(option);
+		TALLOC_FREE(buf);
+		return -1;
+	}
+
+	for (i=0; i < numlines; i++) {
+		if (strequal(lines[i], option)) {
+			write_behind_present = true;
+			break;
+		}
+	}
+
+	if (write_behind_present) {
+		DBG_ERR("Write behind translator is enabled for "
+			"volume (%s), refusing to connect! "
+			"Please check the vfs_glusterfs(8) manpage for "
+			"further details.\n",
+			volume);
+		TALLOC_FREE(lines);
+		TALLOC_FREE(option);
+		TALLOC_FREE(buf);
+		return -1;
+	}
+
+	TALLOC_FREE(lines);
+	TALLOC_FREE(option);
+	TALLOC_FREE(buf);
+	return 0;
+}
+
 static int vfs_gluster_connect(struct vfs_handle_struct *handle,
 			       const char *service,
 			       const char *user)
@@ -357,6 +443,11 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
 		goto done;
 	}
 
+	ret = check_for_write_behind_translator(tmp_ctx, fs, volume);
+	if (ret < 0) {
+		goto done;
+	}
+
 	ret = glfs_set_preopened(volume, handle->conn->connectpath, fs);
 	if (ret < 0) {
 		DEBUG(0, ("%s: Failed to register volume (%s)\n",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list