[Pkg-samba-maint] [samba] 129/135: vfs_glusterfs: Enable per client log file

Ivo De Decker ivodd at moszumanska.debian.org
Sat Jan 11 21:30:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

ivodd pushed a commit to branch master
in repository samba.

commit 9c78cc37444ad4dda5c34c44861006a451e32e19
Author: Poornima Gurusiddaiah <pgurusid at redhat.com>
Date:   Fri Nov 22 05:04:11 2013 +0000

    vfs_glusterfs: Enable per client log file
    
    In Samba configuration file, one of the options of gluster type is
    log file, the value of this option was not allowed to contain any
    variables, as a result all the clients would have a single log file,
    which complicated debugging.
    In this patch, variable substitution is performed for gluster log file.
    Hence allowing user to customise the gluster log file name.
    
    Signed-off-by: Poornima Gurusiddaiah <pgurusid at redhat.com>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Dec 17 23:44:16 CET 2013 on sn-devel-104
    
    Fix bug #10337 - vfs_glusterfs: Enable per client log file.
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Thu Dec 26 21:21:07 CET 2013 on sn-devel-104
---
 source3/modules/vfs_glusterfs.c | 49 ++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index ca7d790..3262f11 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -209,12 +209,18 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
 {
 	const char *volfile_server;
 	const char *volume;
-	const char *logfile;
+	char *logfile;
 	int loglevel;
-	glfs_t *fs;
-	int ret;
+	glfs_t *fs = NULL;
+	TALLOC_CTX *tmp_ctx;
+	int ret = 0;
 
-	logfile = lp_parm_const_string(SNUM(handle->conn), "glusterfs",
+	tmp_ctx = talloc_new(NULL);
+	if (tmp_ctx == NULL) {
+		ret = -1;
+		goto done;
+	}
+	logfile = lp_parm_talloc_string(tmp_ctx, SNUM(handle->conn), "glusterfs",
 				       "logfile", NULL);
 
 	loglevel = lp_parm_int(SNUM(handle->conn), "glusterfs", "loglevel", -1);
@@ -233,57 +239,60 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
 
 	fs = glfs_find_preopened(volume);
 	if (fs) {
-		goto found;
+		goto done;
 	}
 
 	fs = glfs_new(volume);
 	if (fs == NULL) {
-		return -1;
+		ret = -1;
+		goto done;
 	}
 
 	ret = glfs_set_volfile_server(fs, "tcp", volfile_server, 0);
 	if (ret < 0) {
 		DEBUG(0, ("Failed to set volfile_server %s\n", volfile_server));
-		glfs_fini(fs);
-		return -1;
+		goto done;
 	}
 
 	ret = glfs_set_xlator_option(fs, "*-md-cache", "cache-posix-acl",
 				     "true");
 	if (ret < 0) {
 		DEBUG(0, ("%s: Failed to set xlator options\n", volume));
-		glfs_fini(fs);
-		return -1;
+		goto done;
 	}
 
 	ret = glfs_set_logging(fs, logfile, loglevel);
 	if (ret < 0) {
 		DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n",
 			  volume, logfile, loglevel));
-		glfs_fini(fs);
-		return -1;
+		goto done;
 	}
 
 	ret = glfs_init(fs);
 	if (ret < 0) {
 		DEBUG(0, ("%s: Failed to initialize volume (%s)\n",
 			  volume, strerror(errno)));
-		glfs_fini(fs);
-		return -1;
+		goto done;
 	}
 
 	ret = glfs_set_preopened(volume, fs);
 	if (ret < 0) {
 		DEBUG(0, ("%s: Failed to register volume (%s)\n",
 			  volume, strerror(errno)));
-		glfs_fini(fs);
+		goto done;
+	}
+done:
+	talloc_free(tmp_ctx);
+	if (ret < 0) {
+		if (fs)
+			glfs_fini(fs);
 		return -1;
+	} else {
+		DEBUG(0, ("%s: Initialized volume from server %s\n",
+                         volume, volfile_server));
+		handle->data = fs;
+		return 0;
 	}
-found:
-	DEBUG(0, ("%s: Initialized volume from server %s\n",
-		  volume, volfile_server));
-	handle->data = fs;
-	return 0;
 }
 
 static void vfs_gluster_disconnect(struct vfs_handle_struct *handle)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git




More information about the Pkg-samba-maint mailing list