[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-0pre2-126-g88312b9

Karolin Seeger kseeger at samba.org
Sat Mar 22 07:58:39 GMT 2008


The branch, v3-2-stable has been updated
       via  88312b9b05fa32bec0a35d693b2abaaf41340f98 (commit)
       via  e0f4536cc9a95e7453c3c917a743faaab9c62b8b (commit)
      from  04861592b68c18eecfa18034995cc85904665af4 (commit)

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


- Log -----------------------------------------------------------------
commit 88312b9b05fa32bec0a35d693b2abaaf41340f98
Author: root <root at gpfs1.sernet.private>
Date:   Thu Mar 20 15:59:37 2008 +0100

    Port 3c1f1f0797e from 3-0-ctdb
    
    We need to inform ctdb about the client's TCP connection so that after a fail
    over ctdbd can trigger the client to reconnect very quickly
    (cherry picked from commit ddc989886deff173b8a2a2a753a896770efe7545)

commit e0f4536cc9a95e7453c3c917a743faaab9c62b8b
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 20 12:49:13 2008 +0100

    Fix some warnings in the tsmsm module
    
    Alexander, please check!
    (cherry picked from commit df574fd2ee58f008b93b06f4d78c85cb909cc92c)

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

Summary of changes:
 source/modules/vfs_tsmsm.c |   10 ++++---
 source/smbd/server.c       |   60 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/modules/vfs_tsmsm.c b/source/modules/vfs_tsmsm.c
index 791e8cf..aa0f945 100644
--- a/source/modules/vfs_tsmsm.c
+++ b/source/modules/vfs_tsmsm.c
@@ -148,8 +148,9 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle,
         /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
 	   then assume it is not offline (it may not be 100%, as it could be sparse) */
 	if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size * tsmd->online_ratio) {
-		DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld online_ratio=%.2f\n", 
-			  path, stbuf->st_blocks, stbuf->st_size, tsmd->online_ratio));
+		DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld "
+			  "online_ratio=%.2f\n", path, (long)stbuf->st_blocks,
+			  (long)stbuf->st_size, tsmd->online_ratio));
 		return false;
 	}
 
@@ -226,8 +227,9 @@ static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struc
 	   if the file might be offline
 	*/
 	if(SMB_VFS_FSTAT(fsp, &sbuf) == 0) {
-		DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld online_ratio=%.2f\n", 
-			  sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio));
+		DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld "
+			  "online_ratio=%.2f\n", (long)sbuf.st_blocks,
+			  (long)sbuf.st_size, tsmd->online_ratio));
 		return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio);
 	}
 	return false;
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 50c84f9..179d480 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -59,6 +59,23 @@ int get_client_fd(void)
 	return server_fd;
 }
 
+int client_get_tcp_info(struct sockaddr_in *server, struct sockaddr_in *client)
+{
+	socklen_t length;
+	if (server_fd == -1) {
+		return -1;
+	}
+	length = sizeof(*server);
+	if (getsockname(server_fd, (struct sockaddr *)server, &length) != 0) {
+		return -1;
+	}
+	length = sizeof(*client);
+	if (getpeername(server_fd, (struct sockaddr *)client, &length) != 0) {
+		return -1;
+	}
+	return 0;
+}
+
 struct event_context *smbd_event_context(void)
 {
 	static struct event_context *ctx;
@@ -946,10 +963,8 @@ void exit_server_fault(void)
 /****************************************************************************
 received when we should release a specific IP
 ****************************************************************************/
-static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data, 
-                    	   uint32_t msg_type, struct server_id server_id, DATA_BLOB *data)
+static void release_ip(const char *ip, void *priv)
 {
-	const char *ip = (const char *)data->data;
 	char addr[INET6_ADDRSTRLEN];
 
 	if (strcmp(client_socket_addr(get_client_fd(),addr,sizeof(addr)), ip) == 0) {
@@ -964,6 +979,11 @@ static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data
 	}
 }
 
+static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data,
+			   uint32_t msg_type, struct server_id server_id, DATA_BLOB *data)
+{
+	release_ip((char *)data->data, NULL);
+}
 
 /****************************************************************************
  Initialise connect, service and file structs.
@@ -1378,6 +1398,40 @@ extern void build_options(bool screen);
 		exit(1);
 	}
 
+#ifdef CLUSTER_SUPPORT
+
+	if (lp_clustering()) {
+		/*
+		 * We need to tell ctdb about our client's TCP
+		 * connection, so that for failover ctdbd can send
+		 * tickle acks, triggering a reconnection by the
+		 * client.
+		 */
+
+		struct sockaddr_in srv, clnt;
+
+		if (client_get_tcp_info(&srv, &clnt) == 0) {
+
+			NTSTATUS status;
+
+			status = ctdbd_register_ips(
+				messaging_ctdbd_connection(),
+				&srv, &clnt, release_ip, NULL);
+
+			if (!NT_STATUS_IS_OK(status)) {
+				DEBUG(0, ("ctdbd_register_ips failed: %s\n",
+					  nt_errstr(status)));
+			}
+		} else
+		{
+			DEBUG(0,("Unable to get tcp info for "
+				 "CTDB_CONTROL_TCP_CLIENT: %s\n",
+				 strerror(errno)));
+		}
+	}
+
+#endif
+
 	TALLOC_FREE(frame);
 
 	smbd_process();


-- 
Samba Shared Repository


More information about the samba-cvs mailing list