summaryrefslogtreecommitdiffstats
path: root/source3/modules
diff options
context:
space:
mode:
authorPoornima Gurusiddaiah <pgurusid@redhat.com>2013-11-22 05:04:11 +0000
committerJeremy Allison <jra@samba.org>2013-12-17 23:44:16 +0100
commit078c86810f6d3a9c800e00e818531c1df164f763 (patch)
treed6ab9479af8dbc44d4853ec7fbbc7b1c34b80caf /source3/modules
parentfdccaab2a9a1b9d7eebcd7a4d121dbf68ea48dcd (diff)
downloadsamba-078c86810f6d3a9c800e00e818531c1df164f763.tar.gz
samba-078c86810f6d3a9c800e00e818531c1df164f763.tar.xz
samba-078c86810f6d3a9c800e00e818531c1df164f763.zip
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@redhat.com> Reviewed-by: Ira Cooper <ira@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Dec 17 23:44:16 CET 2013 on sn-devel-104
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_glusterfs.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index ca7d790e18..3262f11992 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)