[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4833-gc07bcd6

Stefan Metzmacher metze at samba.org
Sat Jan 17 17:04:44 GMT 2009


The branch, v3-3-test has been updated
       via  c07bcd6efd3383fc3a46fce35fd34df85ab221c9 (commit)
       via  8e13be1db5c51002ae72c42c505a79406b2f4f63 (commit)
       via  fe9ad21b8cb5286845350fe2280da2cbe2647bb7 (commit)
      from  bf7eb0164b0c69d5d0f3019f3aa524846f6a4394 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit c07bcd6efd3383fc3a46fce35fd34df85ab221c9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 14 12:09:46 2009 +0100

    s3:cluster: fix ctdb ipv6 support
    
    We need to use CTDB_CONTROL_TCP_CLIENT instead of CTDB_CONTROL_TCP_ADD.
    
    CTDB_CONTROL_TCP_CLIENT has support for 2 modes in newer ctdb versions:
    
    - with struct ctdb_control_tcp it only supports ipv4.
    - with struct ctdb_control_tcp_addr it supports ipv4 and ipv6.
    
    You need new header files which defines struct ctdb_control_tcp_addr,
    but at runtime it should be fine to work against older
    ctdb versions (<= 1.0.68).
    
    metze
    (cherry picked from commit dc6edf1ab4ae8e3fb3ef40b93135ff0ef5407e12)

commit 8e13be1db5c51002ae72c42c505a79406b2f4f63
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 14 11:52:01 2009 +0100

    s3:docs: vfs_fileid manpage
    
    metze
    (cherry picked from commit 6a94b7b9270f3d69595b93e2632051c9842645c9)

commit fe9ad21b8cb5286845350fe2280da2cbe2647bb7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 14 13:59:09 2009 +0100

    s3:vfs_fileid: readd "fileid:algorithm" as option.
    
    "fileid:mapping" is still supported as fallback.
    
    metze
    (cherry picked from commit 554a89df0cf6d9832778e2913f9fe50b78baeedc)

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

Summary of changes:
 docs-xml/manpages-3/vfs_fileid.8.xml |  112 ++++++++++++++++++++++++++++++++++
 source/include/ctdbd_conn.h          |    4 +-
 source/lib/ctdbd_conn.c              |   30 ++++++---
 source/modules/vfs_fileid.c          |    8 ++-
 source/smbd/server.c                 |    4 +-
 5 files changed, 142 insertions(+), 16 deletions(-)
 create mode 100644 docs-xml/manpages-3/vfs_fileid.8.xml


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/vfs_fileid.8.xml b/docs-xml/manpages-3/vfs_fileid.8.xml
new file mode 100644
index 0000000..202d693
--- /dev/null
+++ b/docs-xml/manpages-3/vfs_fileid.8.xml
@@ -0,0 +1,112 @@
+<?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_fileid.8">
+
+<refmeta>
+	<refentrytitle>vfs_fileid</refentrytitle>
+	<manvolnum>8</manvolnum>
+	<refmiscinfo class="source">Samba</refmiscinfo>
+	<refmiscinfo class="manual">System Administration tools</refmiscinfo>
+	<refmiscinfo class="version">3.2</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+	<refname>vfs_fileid</refname>
+	<refpurpose>Generates file_id structs with unique device id values for
+	cluster setups</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>vfs objects = fileid</command>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>This VFS module is part of the
+	<citerefentry><refentrytitle>samba</refentrytitle>
+	<manvolnum>7</manvolnum></citerefentry>
+	suite.</para>
+
+	<para>Samba uses file_id structs to uniquely identify files
+	for locking purpose. By default the file_id contains the device
+	and inode number returned by the <command>stat()</command> system call.
+	As the file_id is a unique identifier of a file, it must be the same
+	on all nodes in a cluster setup. This module overloads the
+	<command>SMB_VFS_FILE_ID_CREATE()</command> operation and
+	generates the device number based on the configured algorithm
+	(see the "fileid:algorithm" option).
+	</para>
+</refsect1>
+
+
+<refsect1>
+	<title>OPTIONS</title>
+
+	<variablelist>
+
+		<varlistentry>
+		<term>fileid:algorithm = ALGORITHM</term>
+		<listitem>
+		<para>Available algorithms are <command>fsname</command>
+		and <command>fsid</command>. The default value is
+		<command>fsname</command>.
+		</para>
+		<para>The <command>fsname</command> algorithm generates
+		device id by hashing the kernel device name.
+		</para>
+		<para>The <command>fsid</command> algorithm generates
+		the device id from the <command>f_fsid</command> returned
+		from the <command>statfs()</command> syscall.
+		</para>
+		</listitem>
+		</varlistentry>
+
+		<varlistentry>
+		<term>fileid:mapping = ALGORITHM</term>
+		<listitem>
+		<para>This option is the legacy version of the
+		<command>fileid:algorithm</command> option, which was used in earlier
+		versions of fileid mapping feature in custom Samba 3.0 versions.
+		</para>
+		</listitem>
+		</varlistentry>
+
+	</variablelist>
+</refsect1>
+
+<refsect1>
+	<title>EXAMPLES</title>
+
+	<para>Usage of the <command>fileid</command> module with the
+	<command>fsid</command> algorithm:</para>
+
+<programlisting>
+        <smbconfsection name="[global]"/>
+	<smbconfoption name="vfs objects">fileid</smbconfoption>
+	<smbconfoption name="fileid:algorithm">fsid</smbconfoption>
+</programlisting>
+
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+
+	<para>This man page is correct for version 3.2 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/source/include/ctdbd_conn.h b/source/include/ctdbd_conn.h
index 44c3516..d721235 100644
--- a/source/include/ctdbd_conn.h
+++ b/source/include/ctdbd_conn.h
@@ -57,8 +57,8 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
 			void *private_data);
 
 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
-			    const struct sockaddr *server,
-			    const struct sockaddr *client,
+			    const struct sockaddr_storage *server,
+			    const struct sockaddr_storage *client,
 			    void (*release_ip_handler)(const char *ip_addr,
 						       void *private_data),
 			    void *private_data);
diff --git a/source/lib/ctdbd_conn.c b/source/lib/ctdbd_conn.c
index 1b07fd4..c88622d 100644
--- a/source/lib/ctdbd_conn.c
+++ b/source/lib/ctdbd_conn.c
@@ -1174,13 +1174,22 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
  */
 
 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
-			    const struct sockaddr *server,
-			    const struct sockaddr *client,
+			    const struct sockaddr_storage *server,
+			    const struct sockaddr_storage *client,
 			    void (*release_ip_handler)(const char *ip_addr,
 						       void *private_data),
 			    void *private_data)
 {
-	struct ctdb_control_tcp_vnn p;
+	struct sockaddr *sock = (struct sockaddr *)client;
+	/*
+	 * we still use ctdb_control_tcp for ipv4
+	 * because we want to work against older ctdb
+	 * versions at runtime
+	 */
+	struct ctdb_control_tcp p4;
+#ifdef HAVE_IPV6
+	struct ctdb_control_tcp_addr p;
+#endif
 	TDB_DATA data;
 	NTSTATUS status;
 
@@ -1189,15 +1198,19 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
 	 */
 	SMB_ASSERT(conn->release_ip_handler == NULL);
 
-	switch (client->sa_family) {
+	switch (sock->sa_family) {
 	case AF_INET:
-		p.dest.ip = *(struct sockaddr_in *)server;
-		p.src.ip = *(struct sockaddr_in *)client;
+		p4.dest = *(struct sockaddr_in *)server;
+		p4.src = *(struct sockaddr_in *)client;
+		data.dptr = (uint8_t *)&p4;
+		data.dsize = sizeof(p4);
 		break;
 #ifdef HAVE_IPV6
 	case AF_INET6:
 		p.dest.ip6 = *(struct sockaddr_in6 *)server;
 		p.src.ip6 = *(struct sockaddr_in6 *)client;
+		data.dptr = (uint8_t *)&p;
+		data.dsize = sizeof(p);
 		break;
 #endif
 	default:
@@ -1220,11 +1233,8 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
 	 * can send an extra ack to trigger a reset for our client, so it
 	 * immediately reconnects
 	 */
-	data.dptr = (uint8_t *)&p;
-	data.dsize = sizeof(p);
-
 	return ctdbd_control(conn, CTDB_CURRENT_NODE, 
-			     CTDB_CONTROL_TCP_ADD, 0,
+			     CTDB_CONTROL_TCP_CLIENT, 0,
 			     CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL, NULL);
 }
 
diff --git a/source/modules/vfs_fileid.c b/source/modules/vfs_fileid.c
index 8ab4ac3..787a49f 100644
--- a/source/modules/vfs_fileid.c
+++ b/source/modules/vfs_fileid.c
@@ -188,10 +188,16 @@ static int fileid_connect(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
-	data->device_mapping_fn	= fileid_device_mapping_fsid;
+	/*
+	 * "fileid:mapping" is only here as fallback for old setups
+	 * "fileid:algorithm" is the option new setups should use
+	 */
 	algorithm = lp_parm_const_string(SNUM(handle->conn),
 					 "fileid", "mapping",
 					 "fsname");
+	algorithm = lp_parm_const_string(SNUM(handle->conn),
+					 "fileid", "algorithm",
+					 algorithm);
 	if (strcmp("fsname", algorithm) == 0) {
 		data->device_mapping_fn	= fileid_device_mapping_fsname;
 	} else if (strcmp("fsid", algorithm) == 0) {
diff --git a/source/smbd/server.c b/source/smbd/server.c
index fb6bbff..770de41 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -1480,9 +1480,7 @@ extern void build_options(bool screen);
 
 			status = ctdbd_register_ips(
 				messaging_ctdbd_connection(),
-				(struct sockaddr *)&srv,
-				(struct sockaddr *)&clnt,
-				release_ip, NULL);
+				&srv, &clnt, release_ip, NULL);
 
 			if (!NT_STATUS_IS_OK(status)) {
 				DEBUG(0, ("ctdbd_register_ips failed: %s\n",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list