[SCM] Samba Shared Repository - branch v4-7-stable updated

Karolin Seeger kseeger at samba.org
Mon Aug 27 08:07:07 UTC 2018


The branch, v4-7-stable has been updated
       via  2ec3c4d VERSION: Disable GIT_SNAPSHOT for the 4.7.10 release.
       via  eb1028b WHATSNEW: Add release notes for Samba 4.7.10.
       via  b21740a torture: Demonstrate the invalid lock order panic
       via  8ef80a0 vfs_fruit: Fix a leak of "br_lck"
       via  a73d973 selftest: Load time_audit and full_audit modules for all tests
       via  0470afa s3: vfs: time_audit: fix handling of token_blob in smb_time_audit_offload_read_recv()
       via  a329764 g_lock: Fix lock upgrades
       via  cc4eed2 torture3: Extend the g_lock6 test to also cover upgrades
       via  72a4177 torture3: add LOCAL-G-LOCK6 test
       via  50b081a selftest: subunithelper needs to follow the subunit spec more closely
       via  9dcded3 unittests.lib_util_modules: test module probe with "skel", not "unix"
       via  cfcee58 ctdb: add expiry test for ctdb_mutex_ceph_rados_helper
       via  0056094 ctdb_mutex_ceph_rados_helper: fix deadlock via lock renewals
       via  3ec4c73 ctdb_mutex_ceph_rados_helper: rename timer_ev to ppid_timer_ev
       via  05295db ctdb_mutex_ceph_rados_helper: use talloc destructor for cleanup
       via  8c16413 ctdb_mutex_ceph_rados_helper: Set SIGINT signal handler
       via  a18bcf2 ctdb/build: link ctdb_mutex_ceph_rados_helper against ceph-common
       via  fe6886e VERSION: Bump version up to 4.7.10.
       via  764141d Merge tag 'samba-4.7.9' into v4-7-test
       via  a431bdf s3: smbd: Fix AIX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  7bf1568 s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  adb7d6a s3: smbd: Fix HPUX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  2c58fbd s3: smbd: Fix Solaris sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  c166fa0 s3: smbd: Fix Linux sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  2bc9c4d dns wildcards: fix BUG 13536
       via  c6d9862 dns wildcards: tests to confirm BUG 13536
       via  066ba51 s3: smbd: fix path check in smbd_smb2_create_durable_lease_check()
       via  0c37304 s4: torture: run test_durable_v2_open_reopen2_lease() in a subdirectory
       via  80c7e28 s3: libsmbclient: Fix cli_splice() fallback when reading less than a complete file.
       via  a7783f5 s3: torture: Test SMB1 cli_splice() fallback path when doing a non-full file splice.
       via  6cf5809 docs/vfs_ceph: add CTDB_SAMBA_SKIP_SHARE_CHECK=yes caveat
       via  be42bf4 vfs_ceph: don't lie about flock support
       via  5bfa46c ldb: Refuse to build Samba against a newer minor version of ldb
       via  7658ffc samba-tool trust: support discovery via netr_GetDcName
       via  a500e04 s3:selftest: run rpc.lsa.lookupsids also with explicit [smb1] and [smb2]
       via  3aaaeb9 s4:librpc: autonegotiate SMB1/2/3
       via  882db91 python/tests: use explicit "client ipc max protocol = NT1" for samba.tests.net_join_no_spnego
       via  80a0c49 tests/auth_log: Permit SMB2 service description if empty binding is used for kerberos authentication
       via  0af5606 s4:libcli: add smb_connect_nego_{send,recv}()
       via  faa5c60 s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally
       via  73f0518 s4:libcli: add fallback_to_anonymous to smb2_connect_send()
       via  b2e0a78 s4:libcli: allow passing an already negotiated connection to smb2_connect_send()
       via  384a61f s4:libcli: split out smb2_connect_session_start()
       via  630b5b9 s4:libcli: add smb2_transport_raw_init()
       via  139ee19 s4:libcli: allow passing an already negotiated connection to smb_composite_connect()
       via  5bed1ef s4:libcli: use talloc_zero() for struct smb_composite_connect in fetchfile.c
       via  7ee0293 s4:libcli: add smbcli_transport_raw_init()
       via  b2a3582 s4:libcli: split out smb_raw_negotiate_fill_transport()
       via  3f03c9a librpc: add binding handle support for [smb1]
       via  5260dbc s3: smbd: always set vuid in check_user_ok()
       via  50e4615 s3: smbd/durable: remove dev and inode check from vfs_default_durable_reconnect_check_stat()
       via  449d166 libsmbclient: Initialize written in cli_splice_fallback()
       via  956d7c7 libsmbclient: Initialize written value before use.
       via  6699ce8 lib: smb_threads: fix access before init bug
       via  c93357b python: pysmbd: Additional error path leak fix.
       via  ab45387 s3:smbd: don't allow renaming basefile if streams are open
       via  279fa62 s3:locking: add file_has_open_streams()
       via  2da420e s3:smbd: add private option NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN
       via  ab32e7a s4:torture/vfs/fruit: adjust test testing basefile rename to expect failure
       via  7d0b1fd s4:torture/smb2/streams: try to rename basefile while is has open streams
       via  7f84f9f selftest: run smb2.streams tests against a share with vfs_streams_xattr
       via  0a3ba68 vfs_fruit: delete 0 byte size streams if AAPL is enabled
       via  1a500df s4:torture: test setting EOF of a stream to 0 with enabled AAPL extensions
       via  c5ed2b3 s4:torture/vfs/fruit: decrease large resource fork size in test from 1 GB to 64 MB
       via  58403cb s3/notifyd.c: Rename CTDB_BROADCAST_VNNMAP to CTDB_BROADCAST_ACTIVE.
       via  516448f ctdb-tests: Avoid segfault by initializing logging
       via  bea8c19 ctdb-tests: Avoid segfault by initializing logging
       via  5f0ba9c ctdb-pmda: Use modified API in pcp library 4.0
       via  66d36b3 socket_wrapper: Add missing dependency on tirpc
       via  7fd58cb ctdb-daemon: Only consider client ID for local database attach
       via  b521f79 ctdb-docs: Fix the documentation for VNN map
       via  99d490d ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVE
       via  9352dd5 ctdb-tests: Add a simple test for database traverses
       via  93c09bd ctdb-tests: Add check for non-lmaster node status in integration tests
       via  e728f9f s4:kcc: Add a NULL check before qsort()
       via  84bac58 s3:smbget: Fix buffer truncation issues with gcc8
       via  e0a7415 s3:registry: Fix buffer truncation issues issues with gcc8
       via  ce0b090 samdb: Fix build error with gcc8
       via  bc6a072 s3-winbindd: remove unused fill_domain_username()
       via  6fa0630 s3-winbindd: use fill_domain_username_talloc() in winbind.
       via  7b6a1de s3:libnet: Fix format-truncation warning in samsync_ldif
       via  6aaf3a8 lib: Fix array size in audit_logging
       via  aab4aca s4:ntvfs: Fix string copy of share_name
       via  461bd25 lib:util: Fix parameter aliasing in tfork test
       via  99ab2e2 s3:passdb: Fix size of ascii_p16
       via  992faaa s3:lib: Use memcpy() in escape_ldap_string()
       via  7cf1573 s4:torture: Use strlcpy() in gen_name()
       via  c4a2cd3 s3-utils: fix format-truncation in smbpasswd
       via  911417a s4-torture: fix format-truncation warning in smb2 session tests.
       via  c146fd8 s3-printing: fix format-truncation in print_queue_update()
       via  454f425 heimdal: lib/krb5: do not fail set_config_files due to parse error
       via  cdf16fd krb5_wrap: fix keep_old_entries logic for older kerberos libraries
       via  0b95014 VERSION: Bump version up to 4.7.9...
      from  3e5da7e VERSION: Disable GIT_SNAPSHOT for the 4.7.9 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                        |   2 +-
 WHATSNEW.txt                                   | 109 ++++++++-
 auth/auth_log.c                                |   2 +-
 ctdb/doc/ctdb.1.xml                            |   7 +-
 ctdb/include/ctdb_private.h                    |   7 +-
 ctdb/protocol/protocol.h                       |   2 +-
 ctdb/protocol/protocol_debug.c                 |   4 +-
 ctdb/server/ctdb_control.c                     |  36 ++-
 ctdb/server/ctdb_ltdb_server.c                 |  21 +-
 ctdb/server/ctdb_server.c                      |  16 +-
 ctdb/server/ctdb_traverse.c                    |   4 +-
 ctdb/tests/scripts/integration.bash            |   1 +
 ctdb/tests/simple/79_volatile_db_traverse.sh   |  94 ++++++++
 ctdb/tests/src/ctdb_takeover_tests.c           |   2 +
 ctdb/tests/src/fetch_loop.c                    |   3 +
 ctdb/tests/src/fetch_loop_key.c                |   3 +
 ctdb/tests/src/fetch_readonly.c                |   3 +
 ctdb/tests/src/fetch_readonly_loop.c           |   3 +
 ctdb/tests/src/fetch_ring.c                    |   3 +
 ctdb/tests/src/g_lock_loop.c                   |   4 +-
 ctdb/tests/src/message_ring.c                  |   3 +
 ctdb/tests/src/transaction_loop.c              |   3 +
 ctdb/tests/src/update_record.c                 |   3 +
 ctdb/tests/src/update_record_persistent.c      |   3 +
 ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c | 200 ++++++++++++----
 ctdb/utils/ceph/test_ceph_rados_reclock.sh     |  57 ++++-
 ctdb/utils/pmda/pmda_ctdb.c                    |  30 ++-
 ctdb/wscript                                   |  17 +-
 docs-xml/manpages/vfs_ceph.8.xml               |  19 ++
 lib/krb5_wrap/krb5_samba.c                     |   2 +-
 lib/ldb/wscript                                |  32 ++-
 lib/socket_wrapper/wscript                     |   2 +-
 lib/util/smb_threads.h                         |   3 +
 lib/util/tests/tfork.c                         |   7 +-
 librpc/rpc/binding.c                           |   1 +
 librpc/rpc/rpc_common.h                        |   2 +
 python/samba/netcmd/domain.py                  |  26 +-
 python/samba/tests/auth_log.py                 |  28 ++-
 python/samba/tests/dns_wildcard.py             |  48 ++++
 python/samba/tests/net_join_no_spnego.py       |   2 +
 selftest/knownfail                             |   3 +
 selftest/subunithelper.py                      |   3 +-
 selftest/target/Samba3.pm                      |  12 +-
 source3/include/smb.h                          |   3 +
 source3/lib/g_lock.c                           |   4 +
 source3/lib/ldap_escape.c                      |   2 +-
 source3/lib/sendfile.c                         | 293 ++++++++++++++++++++---
 source3/libnet/libnet_samsync_ldif.c           |   3 +-
 source3/libsmb/clireadwrite.c                  |   6 +-
 source3/libsmb/libsmb_file.c                   |   2 +-
 source3/locking/locking.c                      |  31 +++
 source3/locking/proto.h                        |   1 +
 source3/modules/vfs_ceph.c                     |  11 +-
 source3/modules/vfs_fruit.c                    |  27 ++-
 source3/modules/vfs_time_audit.c               |  12 +-
 source3/passdb/pdb_smbpasswd.c                 |   2 +-
 source3/printing/printing.c                    |   2 +-
 source3/registry/reg_perfcount.c               |  12 +-
 source3/selftest/tests.py                      |  12 +-
 source3/smbd/durable.c                         |  24 --
 source3/smbd/notifyd/notifyd.c                 |   4 +-
 source3/smbd/open.c                            |   7 +-
 source3/smbd/pysmbd.c                          |   1 +
 source3/smbd/reply.c                           |   4 +
 source3/smbd/smb2_create.c                     |  16 +-
 source3/smbd/uid.c                             |   2 +
 source3/torture/proto.h                        |   1 +
 source3/torture/test_g_lock.c                  | 168 +++++++++++++
 source3/torture/torture.c                      | 154 ++++++++++++
 source3/utils/smbget.c                         |   2 +-
 source3/utils/smbpasswd.c                      |  49 ++--
 source3/winbindd/wb_getpwsid.c                 |  15 +-
 source3/winbindd/wb_query_user_list.c          |   9 +-
 source3/winbindd/winbindd_group.c              |  12 +-
 source3/winbindd/winbindd_list_groups.c        |  14 +-
 source3/winbindd/winbindd_pam.c                |  13 +-
 source3/winbindd/winbindd_proto.h              |   1 -
 source3/winbindd/winbindd_util.c               |  20 --
 source4/dns_server/dnsserver_common.c          |   1 +
 source4/dsdb/kcc/kcc_topology.c                |   5 +
 source4/dsdb/samdb/ldb_modules/samldb.c        |   2 +-
 source4/heimdal/lib/krb5/config_file.c         |   4 +-
 source4/heimdal/lib/krb5/context.c             |   3 +-
 source4/libcli/raw/clitransport.c              |  44 ++++
 source4/libcli/raw/clitree.c                   |   1 +
 source4/libcli/raw/rawnegotiate.c              |  74 +++---
 source4/libcli/smb2/connect.c                  |  69 +++++-
 source4/libcli/smb2/session.c                  |  35 ++-
 source4/libcli/smb2/transport.c                |  35 +++
 source4/libcli/smb_composite/connect.c         |  48 +++-
 source4/libcli/smb_composite/connect_nego.c    | 209 ++++++++++++++++
 source4/libcli/smb_composite/fetchfile.c       |   2 +-
 source4/libcli/smb_composite/smb_composite.h   |  23 ++
 source4/libcli/wscript_build                   |  20 +-
 source4/librpc/rpc/dcerpc_connect.c            | 257 ++++++++++----------
 source4/ntvfs/cifs/vfs_cifs.c                  |   1 +
 source4/ntvfs/ipc/rap_server.c                 |   9 +-
 source4/torture/basic/mangle_test.c            |   2 +-
 source4/torture/smb2/durable_v2_open.c         |  11 +-
 source4/torture/smb2/session.c                 |   2 +-
 source4/torture/smb2/streams.c                 |  82 +++++++
 source4/torture/vfs/fruit.c                    | 315 +++++++++++++++++++++++--
 testsuite/unittests/test_lib_util_modules.c    |   2 +-
 103 files changed, 2502 insertions(+), 525 deletions(-)
 create mode 100755 ctdb/tests/simple/79_volatile_db_traverse.sh
 create mode 100644 source4/libcli/smb_composite/connect_nego.c


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 8348485..0f3c07e 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=7
-SAMBA_VERSION_RELEASE=9
+SAMBA_VERSION_RELEASE=10
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c812417..98fcfe5 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,108 @@
+                   ==============================
+                   Release Notes for Samba 4.7.10
+                           August 27, 2018
+                   ==============================
+
+
+This is the latest stable release of the Samba 4.7 release series.
+
+
+Changes since 4.7.9:
+--------------------
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 13474: python: pysmbd: Additional error path leak fix.
+   * BUG 13511: libsmbclient: Initialize written value before use.
+   * BUG 13527: s3: libsmbclient: Fix cli_splice() fallback when reading less
+     than a complete file.
+   * BUG 13537: Using "sendfile = yes" with SMB2 can cause CPU spin.
+
+o  Jeffrey Altman <jaltman at secure-endpoints.com>
+   * BUG 11573: heimdal: lib/krb5: Do not fail set_config_files due to parse
+     error.
+
+o  Andrew Bartlett <abartlet at samba.org>
+   * BUG 13519: ldb: Refuse to build Samba against a newer minor version of
+     ldb.
+
+o  Bailey Berro <baileyberro at chromium.org>
+   * BUG 13511: libsmbclient: Initialize written in cli_splice_fallback().
+
+o  Alexander Bokovoy <ab at samba.org>
+   * BUG 13538: samba-tool trust: Support discovery via netr_GetDcName.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 13318: Durable Handles reconnect fails in a cluster when the cluster
+     fs uses different device ids.
+   * BUG 13351: s3: smbd: Always set vuid in check_user_ok().
+   * BUG 13505: lib: smb_threads: Fix access before init bug.
+   * BUG 13535: s3: smbd: Fix path check in
+     smbd_smb2_create_durable_lease_check().
+   * BUG 13451: Fail renaming file if that file has open streams.
+
+o  G√ľnther Deschner <gd at samba.org>
+   * BUG 13437: Fix building Samba with gcc 8.1.
+
+o  David Disseldorp <ddiss at samba.org>
+   * BUG 13506: vfs_ceph: Don't lie about flock support.
+   * BUG 13540: Fix deadlock with ctdb_mutex_ceph_rados_helper.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 13195: g_lock: Fix lock upgrades.
+   * BUG 13584: vfs_fruit: Fix a panic if fruit_access_check detects a locking
+     conflict.
+
+o  Gary Lockyer <gary at catalyst.net.nz>
+   * BUG 13536: The current position in the dns name was not advanced past the
+     '.' character.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 13308: samba-tool domain trust: Fix trust compatibility to Windows
+     Server 1709 and FreeIPA.
+
+o  Christof Schmitt <cs at samba.org>
+   * BUG 13478: krb5_wrap: Fix keep_old_entries logic for older kerberos
+     libraries.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 13437: Fix building Samba with gcc 8.1.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 13499: Don't use CTDB_BROADCAST_VNNMAP.
+   * BUG 13500: ctdb-daemon: Only consider client ID for local database attach.
+
+o  Karolin Seeger <kseeger at samba.org>
+   * BUG 13499: s3/notifyd.c: Rename CTDB_BROADCAST_VNNMAP to
+     CTDB_BROADCAST_ACTIVE.
+
+o  Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
+   * BUG 13568: vfs_time_audit: Fix handling of token_blob in
+     smb_time_audit_offload_read_recv().
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the "Samba 4.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
                    =============================
                    Release Notes for Samba 4.7.9
                            August 14, 2018
@@ -74,8 +179,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.7.8
diff --git a/auth/auth_log.c b/auth/auth_log.c
index d4c6c44..72d8f81 100644
--- a/auth/auth_log.c
+++ b/auth/auth_log.c
@@ -350,7 +350,7 @@ static void add_version(struct json_context *context, int major, int minor)
 static void add_timestamp(struct json_context *context)
 {
 	char buffer[40];	/* formatted time less usec and timezone */
-	char timestamp[50];	/* the formatted ISO 8601 time stamp	 */
+	char timestamp[65];	/* the formatted ISO 8601 time stamp	 */
 	char tz[10];		/* formatted time zone			 */
 	struct tm* tm_info;	/* current local time			 */
 	struct timeval tv;	/* current system time			 */
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index 471d825..ae3b9d3 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -292,10 +292,9 @@
 	<title>Virtual Node Number (VNN) map</title>
 	<para>
 	  Consists of the number of virtual nodes and mapping from
-	  virtual node numbers to physical node numbers.  Virtual
-	  nodes host CTDB databases.  Only nodes that are
-	  participating in the VNN map can become lmaster or dmaster
-	  for database records.
+	  virtual node numbers to physical node numbers.  Only nodes
+	  that are participating in the VNN map can become lmaster for
+	  database records.
 	</para>
       </refsect3>
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index da3760d..03e0068 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -724,9 +724,12 @@ int ctdb_set_db_readonly(struct ctdb_context *ctdb,
 
 int ctdb_process_deferred_attach(struct ctdb_context *ctdb);
 
-int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
+int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
+			       TDB_DATA indata,
 			       TDB_DATA *outdata,
-			       uint8_t db_flags, uint32_t client_id,
+			       uint8_t db_flags,
+			       uint32_t srcnode,
+			       uint32_t client_id,
 			       struct ctdb_req_control_old *c,
 			       bool *async_reply);
 int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, TDB_DATA indata,
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index e116b3a..07554b5 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -43,7 +43,7 @@ enum ctdb_operation {
 /* send a broadcast to all nodes in the cluster, active or not */
 #define CTDB_BROADCAST_ALL    0xF0000002
 /* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
+#define CTDB_BROADCAST_ACTIVE 0xF0000003
 /* send a broadcast to all connected nodes */
 #define CTDB_BROADCAST_CONNECTED 0xF0000004
 /* send a broadcast to selected connected nodes */
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index 7c6d862..163bb41 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -262,8 +262,8 @@ static void ctdb_pnn_print(uint32_t pnn, FILE *fp)
 		fprintf(fp, "CURRENT");
 	} else if (pnn == CTDB_BROADCAST_ALL) {
 		fprintf(fp, "ALL");
-	} else if (pnn == CTDB_BROADCAST_VNNMAP) {
-		fprintf(fp, "VNNMAP");
+	} else if (pnn == CTDB_BROADCAST_ACTIVE) {
+		fprintf(fp, "ACTIVE");
 	} else  if (pnn == CTDB_BROADCAST_CONNECTED) {
 		fprintf(fp, "CONNECTED");
 	} else if (pnn == CTDB_MULTICAST) {
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 6835cca..063cd1d 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -267,18 +267,34 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 	}
 
 	case CTDB_CONTROL_DB_ATTACH:
-	  return ctdb_control_db_attach(ctdb, indata, outdata, 0, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					0,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
-	  return ctdb_control_db_attach(ctdb, indata, outdata,
-					CTDB_DB_FLAGS_PERSISTENT, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					CTDB_DB_FLAGS_PERSISTENT,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
-	  return ctdb_control_db_attach(ctdb, indata, outdata,
-					CTDB_DB_FLAGS_REPLICATED, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					CTDB_DB_FLAGS_REPLICATED,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_SET_CALL:
 		return control_not_implemented("SET_CALL", NULL);
@@ -859,7 +875,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
 		return -1;
 	}
 
-	if (((destnode == CTDB_BROADCAST_VNNMAP) || 
+	if (((destnode == CTDB_BROADCAST_ACTIVE) ||
 	     (destnode == CTDB_BROADCAST_ALL) ||
 	     (destnode == CTDB_BROADCAST_CONNECTED)) && 
 	    !(flags & CTDB_CTRL_FLAG_NOREPLY)) {
@@ -867,7 +883,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
 		return -1;
 	}
 
-	if (destnode != CTDB_BROADCAST_VNNMAP && 
+	if (destnode != CTDB_BROADCAST_ACTIVE &&
 	    destnode != CTDB_BROADCAST_ALL && 
 	    destnode != CTDB_BROADCAST_CONNECTED && 
 	    (!ctdb_validate_pnn(ctdb, destnode) || 
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index c199aac..ca5bb12 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1105,9 +1105,12 @@ int ctdb_process_deferred_attach(struct ctdb_context *ctdb)
 /*
   a client has asked to attach a new database
  */
-int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
+int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
+			       TDB_DATA indata,
 			       TDB_DATA *outdata,
-			       uint8_t db_flags, uint32_t client_id,
+			       uint8_t db_flags,
+			       uint32_t srcnode,
+			       uint32_t client_id,
 			       struct ctdb_req_control_old *c,
 			       bool *async_reply)
 {
@@ -1128,7 +1131,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
 	 * allow all attach from the network since these are always from remote
 	 * recovery daemons.
 	 */
-	if (client_id != 0) {
+	if (srcnode == ctdb->pnn && client_id != 0) {
 		client = reqid_find(ctdb->idr, client_id, struct ctdb_client);
 	}
 	if (client != NULL) {
@@ -1535,9 +1538,15 @@ static void ctdb_ltdb_seqnum_check(struct tevent_context *ev,
 		TDB_DATA data;
 		data.dptr = (uint8_t *)&ctdb_db->db_id;
 		data.dsize = sizeof(uint32_t);
-		ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
-					 CTDB_CONTROL_UPDATE_SEQNUM, 0, CTDB_CTRL_FLAG_NOREPLY,
-					 data, NULL, NULL);		
+		ctdb_daemon_send_control(ctdb,
+					 CTDB_BROADCAST_ACTIVE,
+					 0,
+					 CTDB_CONTROL_UPDATE_SEQNUM,
+					 0,
+					 CTDB_CTRL_FLAG_NOREPLY,
+					 data,
+					 NULL,
+					 NULL);
 	}
 	ctdb_db->seqnum = new_seqnum;
 
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 9006741..93256ec 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -389,14 +389,18 @@ static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
 }
 
 /*
-  broadcast a packet to all nodes in the current vnnmap
+  broadcast a packet to all active nodes
 */
-static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb, 
+static void ctdb_broadcast_packet_active(struct ctdb_context *ctdb,
 					 struct ctdb_req_header *hdr)
 {
 	int i;
-	for (i=0;i<ctdb->vnn_map->size;i++) {
-		hdr->destnode = ctdb->vnn_map->map[i];
+	for (i = 0; i < ctdb->num_nodes; i++) {
+		if (ctdb->nodes[i]->flags & NODE_FLAGS_INACTIVE) {
+			continue;
+		}
+
+		hdr->destnode = ctdb->nodes[i]->pnn;
 		ctdb_queue_packet(ctdb, hdr);
 	}
 }
@@ -430,8 +434,8 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	case CTDB_BROADCAST_ALL:
 		ctdb_broadcast_packet_all(ctdb, hdr);
 		return;
-	case CTDB_BROADCAST_VNNMAP:
-		ctdb_broadcast_packet_vnnmap(ctdb, hdr);
+	case CTDB_BROADCAST_ACTIVE:
+		ctdb_broadcast_packet_active(ctdb, hdr);
 		return;
 	case CTDB_BROADCAST_CONNECTED:
 		ctdb_broadcast_packet_connected(ctdb, hdr);
diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c
index 04a4113..5ea1970 100644
--- a/ctdb/server/ctdb_traverse.c
+++ b/ctdb/server/ctdb_traverse.c
@@ -387,8 +387,8 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
 	}
 
 	if (ctdb_db_volatile(ctdb_db)) {
-		/* normal database, traverse all nodes */	  
-		destination = CTDB_BROADCAST_VNNMAP;
+		/* volatile database, traverse all active nodes */
+		destination = CTDB_BROADCAST_ACTIVE;
 	} else {
 		int i;
 		/* persistent database, traverse one node, preferably
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index d72c471..4cdbb7c 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -338,6 +338,7 @@ node_has_status ()
 	(monon)        mpat='^Monitoring mode:ACTIVE \(0\)$' ;;
 	(monoff)       mpat='^Monitoring mode:DISABLED \(1\)$' ;;
 	(recovered)    rpat='^Recovery mode:RECOVERY \(1\)$' ;;
+	(notlmaster)   rpat="^hash:.* lmaster:${pnn}\$" ;;
 	*)
 	    echo "node_has_status: unknown status \"$status\""
 	    return 1
diff --git a/ctdb/tests/simple/79_volatile_db_traverse.sh b/ctdb/tests/simple/79_volatile_db_traverse.sh
new file mode 100755
index 0000000..50732ca
--- /dev/null
+++ b/ctdb/tests/simple/79_volatile_db_traverse.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Confirm that traverses of volatile databases work as expected
+
+This is a very simple example.  It writes a single record, updates it
+on another node and then confirms that the correct value is found when
+traversing.  It then repeats this after removing the LMASTER role from
+the node where the value is updated.
+
+Expected results:
+
+* The expected records should be found
+
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+#
+# Main test
+#
+TESTDB="traverse_db.tdb"
+
+echo "create volatile test database $TESTDB"
+try_command_on_node 0 $CTDB attach "$TESTDB"
+
+echo "wipe test database $TESTDB"
+try_command_on_node 0 $CTDB wipedb "$TESTDB"
+
+echo "write foo=bar0 on node 0"
+try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
+
+echo "write foo=bar1 on node 1"
+try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
+
+echo "do traverse on node 0"
+try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+
+echo "do traverse on node 1"
+try_command_on_node -v 1 $CTDB catdb "$TESTDB"
+
+cat <<EOF
+
+Again, this time with lmaster role off on node 1
+
+EOF
+
+echo "wipe test database $TESTDB"
+try_command_on_node 0 $CTDB wipedb "$TESTDB"
+
+echo "switching off lmaster role on node 1"
+try_command_on_node 1 $CTDB setlmasterrole off
+
+try_command_on_node -v 1 $CTDB getcapabilities
+
+wait_until_node_has_status 1 notlmaster 10 0
+# Wait for recovery and new VNN map to be pushed
+#sleep_for 10
+
+echo "write foo=bar0 on node 0"
+try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
+
+echo "write foo=bar1 on node 1"
+try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
+
+echo "do traverse on node 0"
+try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+
+num=$(echo "$out" | sed -n -e 's|^Dumped \(.*\) records$|\1|p')
+if [ "$num" = 1 ] ; then
+	echo "OK: There was 1 record"
+else
+	echo "BAD: There were ${num} (!= 1) records"
+	exit 1
+fi
+
+if echo "$out" | grep -q "^data(4) = \"bar1\"\$" ; then
+	echo "OK: Data from node 1 was returned"
+else
+	echo "BAD: Data from node 1 was not returned"
+	exit 1
+fi
diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c
index 5093757..f78114a 100644
--- a/ctdb/tests/src/ctdb_takeover_tests.c
+++ b/ctdb/tests/src/ctdb_takeover_tests.c
@@ -254,6 +254,8 @@ int main(int argc, const char *argv[])
 	int loglevel;
 	const char *debuglevelstr = getenv("CTDB_TEST_LOGLEVEL");
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list