[SCM] Samba Shared Repository - branch master updated

David Disseldorp ddiss at samba.org
Wed Feb 15 20:01:02 UTC 2017


The branch, master has been updated
       via  07bbd7f docs/vfs_ceph: document user_id parameter
       via  ec788be vfs_ceph: add user_id smb.conf parameter
       via  eb39aa4 vfs_ceph: replace deprecated ceph_shutdown() call
       via  667fb18 vfs_ceph: cleanup mount handle on failure
      from  129015d lib: Fix "is_case_sensitive" in "ms_fnmatch_protocol"' callers

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 07bbd7fb449fbe64a682c4e6b0cf93fe91006a2e
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Feb 8 17:49:43 2017 +0100

    docs/vfs_ceph: document user_id parameter
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Wed Feb 15 21:00:53 CET 2017 on sn-devel-144

commit ec788bead3118a8b9c6069c702357ea5509db868
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Feb 8 17:26:14 2017 +0100

    vfs_ceph: add user_id smb.conf parameter
    
    The "ceph: user_id" parameter can be specified in smb.conf to explicitly
    set the Ceph client ID used when creating the mount handle.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit eb39aa4695dbda4ed32aa0b907b501fcf1a7ef01
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Feb 8 17:51:32 2017 +0100

    vfs_ceph: replace deprecated ceph_shutdown() call
    
    ceph_shutdown() is the equivalent to ceph_unmount() + ceph_release()
    without error handling.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 667fb18f1ecc97832832a1f9cedc044d004f1929
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Feb 8 17:11:30 2017 +0100

    vfs_ceph: cleanup mount handle on failure
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

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

Summary of changes:
 docs-xml/manpages/vfs_ceph.8.xml | 14 ++++++++++
 source3/modules/vfs_ceph.c       | 60 ++++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_ceph.8.xml b/docs-xml/manpages/vfs_ceph.8.xml
index 37d50b9..c492d31 100644
--- a/docs-xml/manpages/vfs_ceph.8.xml
+++ b/docs-xml/manpages/vfs_ceph.8.xml
@@ -83,6 +83,20 @@
 		</listitem>
 		</varlistentry>
 
+		<varlistentry>
+		<term>ceph:user_id = name</term>
+		<listitem>
+		<para>
+			Allows one to explicitly set the client ID used for the
+			CephFS mount handle. Empty by default (CephFS uses the
+			process id).
+		</para>
+		<para>
+			Example: ceph:user_id = samba
+		</para>
+		</listitem>
+		</varlistentry>
+
 	</variablelist>
 
 </refsect1>
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 75233ef..b74c214 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -85,8 +85,9 @@ static int cephwrap_connect(struct vfs_handle_struct *handle,  const char *servi
 {
 	int ret;
 	char buf[256];
-
-	const char * conf_file;
+	int snum = SNUM(handle->conn);
+	const char *conf_file;
+	const char *user_id;
 
 	if (cmount) {
 		handle->data = cmount; /* We have been here before */
@@ -94,36 +95,34 @@ static int cephwrap_connect(struct vfs_handle_struct *handle,  const char *servi
 		return 0;
 	}
 
-	conf_file = lp_parm_const_string(SNUM(handle->conn), "ceph", "config_file", NULL);
+	/* if config_file and/or user_id are NULL, ceph will use defaults */
+	conf_file = lp_parm_const_string(snum, "ceph", "config_file", NULL);
+	user_id = lp_parm_const_string(snum, "ceph", "user_id", NULL);
 
-	DBG_DEBUG( "[CEPH] calling: ceph_create\n" );
-	ret = ceph_create(&cmount, NULL);
-	if (ret)
+	DBG_DEBUG("[CEPH] calling: ceph_create\n");
+	ret = ceph_create(&cmount, user_id);
+	if (ret) {
 		goto err_out;
-
-	if (conf_file) {
-		/* Override the config file */
-		DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file\n" );
-		ret = ceph_conf_read_file(cmount, conf_file);
-	} else {
-
-		DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file with %s\n", conf_file);
-		ret = ceph_conf_read_file(cmount, NULL);
 	}
 
-	if (ret)
-		goto err_out;
+	DBG_DEBUG("[CEPH] calling: ceph_conf_read_file with %s\n",
+		  (conf_file == NULL ? "default path" : conf_file));
+	ret = ceph_conf_read_file(cmount, conf_file);
+	if (ret) {
+		goto err_cm_release;
+	}
 
-	DBG_DEBUG( "[CEPH] calling: ceph_conf_get\n" );
+	DBG_DEBUG("[CEPH] calling: ceph_conf_get\n");
 	ret = ceph_conf_get(cmount, "log file", buf, sizeof(buf));
-	if (ret < 0)
-		goto err_out;
+	if (ret < 0) {
+		goto err_cm_release;
+	}
 
 	DBG_DEBUG("[CEPH] calling: ceph_mount\n");
 	ret = ceph_mount(cmount, NULL);
-	if (ret < 0)
-		goto err_out;
-
+	if (ret < 0) {
+		goto err_cm_release;
+	}
 
 	/*
 	 * encode mount context/state into our vfs/connection holding structure
@@ -134,6 +133,9 @@ static int cephwrap_connect(struct vfs_handle_struct *handle,  const char *servi
 
 	return 0;
 
+err_cm_release:
+	ceph_release(cmount);
+	cmount = NULL;
 err_out:
 	/*
 	 * Handle the error correctly. Ceph returns -errno.
@@ -144,6 +146,8 @@ err_out:
 
 static void cephwrap_disconnect(struct vfs_handle_struct *handle)
 {
+	int ret;
+
 	if (!cmount) {
 		DBG_ERR("[CEPH] Error, ceph not mounted\n");
 		return;
@@ -155,7 +159,15 @@ static void cephwrap_disconnect(struct vfs_handle_struct *handle)
 		return;
 	}
 
-	ceph_shutdown(cmount);
+	ret = ceph_unmount(cmount);
+	if (ret < 0) {
+		DBG_ERR("[CEPH] failed to unmount: %s\n", strerror(-ret));
+	}
+
+	ret = ceph_release(cmount);
+	if (ret < 0) {
+		DBG_ERR("[CEPH] failed to release: %s\n", strerror(-ret));
+	}
 
 	cmount = NULL;  /* Make it safe */
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list