[SCM] Samba Shared Repository - branch v4-9-test updated

Karolin Seeger kseeger at samba.org
Wed Oct 10 16:59:02 UTC 2018


The branch, v4-9-test has been updated
       via  a1a4e54 lib: Avoid the use of open_memstream in tevent_req_profile_string
       via  33515c3 smb2_server: set req->do_encryption = true earlier
       via  8657e55 s4:torture: split smb2.session.expire{1,2} to run with signing and encryptpion
       via  07c9723 ctdb-tests: Drop code for RECEIVE_RECORDS control
       via  0147504 ctdb-protocol: Drop marshalling code for RECEIVE_RECORDS control
       via  a1a6795 ctdb-protocol: Mark RECEIVE_RECORDS control obsolete
       via  6294ea4 ctdb-daemon: Drop implementation of RECEIVE_RECORDS control
       via  e209cfc ctdb-vacuum: Remove unnecessary check for zero records in delete list
       via  cbfb00b ctdb-vacuum: Fix the incorrect counting of remote errors
       via  485fa6b ctdb-vacuum: Simplify the deletion of vacuumed records
       via  4e00714 ctdb-tests: Add recovery record resurrection test for volatile databases
       via  d8087c0 ctdb-daemon: Invalidate records if a node becomes INACTIVE
       via  0dffb5c ctdb-daemon: Don't pull any records if records are invalidated
       via  75d97d4 ctdb-daemon: Add invalid_records flag to ctdb_db_context
       via  b81cf01 s3: smbd: Prevent valgrind errors in smbtorture3 POSIX test.
       via  1131c14 examples: Fix the smb2mount build
       via  2e602d7 s3:smbget: Use cmdline_messaging_context
       via  217373b s3:smbcontrol: Use cmdline_messaging_context
       via  def7d7c s3:dbwrap_tool: Use cmdline_messaging_context
       via  e399450 s3:eventlogadm: Use cmdline_messaging_context
       via  0442b1f s3: ntlm_auth: Use cmdline_messaging_context
       via  b71c6d2 s3:sharesec: Use cmdline_messaging_context
       via  4881ca3 s3:testparm: Use cmdline_messaging_context
       via  212a5bc s3:pdbedit: Use cmdline_messaging_context
       via  2e78c3a7 s3:messaging: remove unused messaging_init_client()
       via  79fe788 s3:net: Use cmdline_messaging_context
       via  c2dd495 rpcclient: Use cmdline_messaging_context
       via  55886f7 s3:smbstatus: Use cmdline_messaging_context
       via  49f962f s3:smbpasswd: Use cmdline_messaging_context
       via  8251e95 test:doc: Skip 'clustering=yes'
       via  9329a28 s3:popt_common: use cmdline_messaging_context() in popt_common_credentials_callback()
       via  bbdefe8 selftest: pass configfile to pdbedit
       via  b02c52c s3:loadparm: reinit_globals in lp_load_with_registry_shares()
       via  b63a200 s3:lib: Introduce cmdline context wrapper
       via  c247ae0 s3:lib: Move popt_common_credentials to separate file
       via  7791f20 s3/lib:popt_common: Move setup_logging to common callback
       via  240586b s3:lib/server_contexts: make server_event_ctx and server_msg_ctx static
      from  29883c7 waf: Add -fstack-clash-protection

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


- Log -----------------------------------------------------------------
commit a1a4e54cf0ee5c753425fbf7c3b1f78e98ed78c0
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 7 14:47:26 2018 +0200

    lib: Avoid the use of open_memstream in tevent_req_profile_string
    
    Solaris does not have it.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13629
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e7d3678ddb5916416193d553f3cc562627e7d8ab)
    
    Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Wed Oct 10 18:57:59 CEST 2018 on sn-devel-144

commit 33515c39b316c5658cd23b7ed0d24c5a83bba15d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 17 11:35:41 2018 +0200

    smb2_server: set req->do_encryption = true earlier
    
    The STATUS_SESSION_EXPIRED error was returned unencrypted,
    if the request was encrypted.
    
    If clients use SMB3 encryption and the kerberos authenticated session
    expires, clients disconnect the connection instead of doing a reauthentication.
    
    From https://blogs.msdn.microsoft.com/openspecification/2012/10/05/encryption-in-smb-3-0-a-protocol-perspective/
    
      The sender encrypts the message if any of the following conditions is
      satisfied:
    
        - If the sender is sending a response to an encrypted request.
        - If Session.EncryptData is TRUE and the request or response being
          sent is not NEGOTIATE.
        - If Session.EncryptData is FALSE, the request or response being sent
          is not NEGOTIATE or SESSION_SETUP or TREE_CONNECT, and
          <TreeConnect|Share>.EncryptData is TRUE.
    
    [MS-SMB2] 3.3.4.1.4 Encrypting the Message
    
     If Connection.Dialect belongs to the SMB 3.x dialect family and
     Connection.ClientCapabilities includes the SMB2_GLOBAL_CAP_ENCRYPTION
     bit, the server MUST encrypt the message before sending, if any of the
     following conditions are satisfied:
    
     - If the message being sent is any response to a client request for which
       Request.IsEncrypted is TRUE.
    
     - If Session.EncryptData is TRUE and the response being sent is not
       SMB2_NEGOTIATE or SMB2 SESSION_SETUP.
    
     - If Session.EncryptData is FALSE, the response being sent is not
       SMB2_NEGOTIATE or SMB2 SESSION_SETUP or SMB2 TREE_CONNECT, and
       Share.EncryptData for the share associated with the TreeId in the SMB2
       header of the response is TRUE.
    
     The server MUST encrypt the message as specified in section 3.1.4.3,
     before sending it to the client.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13624
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Tue Oct  2 14:11:30 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 4ef45e5334d5874f5d0fdc69286b745ebcdc612d)

commit 8657e558a2edc65e7a05f7bf4c0896a70845b36b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 28 12:23:37 2018 +0200

    s4:torture: split smb2.session.expire{1,2} to run with signing and encryptpion
    
    This reproduces the problem we have with expired encrypted sessions.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13624
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 01b868455c9bae309d1ca7ddad54077fc5d7f4b1)

commit 07c97238bc7bf3e7ac02c8159b9599d938f5a7fc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 15 12:28:36 2018 +1100

    ctdb-tests: Drop code for RECEIVE_RECORDS control
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 83b3c5670d85c607c1cf1ab8cfc2c967d4d16721)

commit 0147504ff77cd4dd284242a8fa8a289aae0c4f12
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 15 12:21:57 2018 +1100

    ctdb-protocol: Drop marshalling code for RECEIVE_RECORDS control
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 2f89bd96fb6c5e50cfc09604ceb6b96a94cb4f56)

commit a1a679563bab8b7e715d9a52653b0e26bae0de34
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 15 13:52:10 2018 +1100

    ctdb-protocol: Mark RECEIVE_RECORDS control obsolete
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 81dae71fa74bfd83a5701e4841b5a0a13cbe87a1)

commit 6294ea4a519607333c05f679a4229dcad913f4f0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 15 12:04:32 2018 +1100

    ctdb-daemon: Drop implementation of RECEIVE_RECORDS control
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit d18385ea2aa93770996214d056a384a0244e7d73)

commit e209cfc43feaeaf2ad3b068a085791cf76001042
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 15:23:07 2018 +1100

    ctdb-vacuum: Remove unnecessary check for zero records in delete list
    
    Since no records are deleted from RB tree during step 1, there is no
    need for the check.  Run step 2 unconditionally.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit e15cdc652d76b37c58cd114215f00500991bc6b4)

commit cbfb00bc44c966905b657aa6647408ba706da02d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 15:18:17 2018 +1100

    ctdb-vacuum: Fix the incorrect counting of remote errors
    
    If a node fails to delete a record in TRY_DELETE_RECORDS control during
    vacuuming, then it's possible that other nodes also may fail to delete a
    record.  So instead of deleting the record from RB tree on first failure,
    keep track of the remote failures.
    
    Update delete_list.remote_error and delete_list.left statistics only
    once per record during the delete_record_traverse.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit ef052397173522ac2dd0d0bd9660a18a13a3e4fc)

commit 485fa6b29eafbdc2c6937196bfffd68e0f274f40
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 14:50:40 2018 +1100

    ctdb-vacuum: Simplify the deletion of vacuumed records
    
    The 3-phase deletion of vacuumed records was introduced to overcome
    the problem of record(s) resurrection during recovery.  This problem
    is now handled by avoiding the records from recently INACTIVE nodes in
    the recovery process.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 202b9027ba44eee33c2fde2332126be10f719423)

commit 4e0071465b59d1f3c1bf60532ff2666927bf3c83
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 24 16:17:19 2018 +1000

    ctdb-tests: Add recovery record resurrection test for volatile databases
    
    Ensure that deleted records and vacuumed records are not resurrected
    from recently inactive nodes.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit dcc9935995a5a7b40df64653a605d1af89075bd1)

commit d8087c060389ff017c307f5e3249019bbabaa8f1
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 14:19:44 2018 +1100

    ctdb-daemon: Invalidate records if a node becomes INACTIVE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit c4ec99b1d3f1c5bff83bf66e3fd64d45a8be7441)

commit 0dffb5c7427c376b79fb673d369aca7d516044bf
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 14:27:32 2018 +1100

    ctdb-daemon: Don't pull any records if records are invalidated
    
    This avoids unnecessary work during recovery to pull records from nodes
    that were INACTIVE just before the recovery.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 040401ca3abfa266261130f6c5ae4e9718f19cd7)

commit 75d97d491131c6ad895518677ca4bf539220e7f6
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 14 14:29:18 2018 +1100

    ctdb-daemon: Add invalid_records flag to ctdb_db_context
    
    If a node becomes INACTIVE, then all the records in volatile databases
    are invalidated.  This avoids the need to include records from such
    nodes during subsequent recovery after the node comes out INACTIVE state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 71896fddf10a92237d332779ccbb26c059caa649)

commit b81cf0191eebd2e90f53157f187e9c6b7b7b1da1
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Sep 27 14:12:47 2018 -0700

    s3: smbd: Prevent valgrind errors in smbtorture3 POSIX test.
    
    Missing fsp talloc free and linked list delete in error
    paths in close_directory(). Now matches close_normal_file()
    and close_fake_file().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13633
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Sep 29 05:32:41 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 660dbfaeff493359474ebdb36098ac49b3f7ba0c)

commit 1131c14aed6f7c35f18dd06db2ec4476df2ea2f9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 7 07:27:46 2018 +0200

    examples: Fix the smb2mount build
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 94852e3544bf2cace3ddba8b9c89d986d77fdab5)

commit 2e602d77fef3cce94460926ddf0b70ab3b3b4b3f
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Aug 21 16:11:02 2018 -0700

    s3:smbget: Use cmdline_messaging_context
    
    Initialize the messaging context through cmdline_messaging_context to
    allow access to config in clustered Samba.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 20ed13923ed3c55e1b293e5440028d29384e9d3a)

commit 217373b05d36afe3162fc64514580186114bc1db
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Aug 21 12:35:11 2018 -0700

    s3:smbcontrol: Use cmdline_messaging_context
    
    Initialize the messaging context through cmdline_messaging_context to
    allow access to config in clustered Samba.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit de040eafbd7d729316d757c14c44df163a4b36ad)

commit def7d7cee44ad557741111f936499942d70f9537
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Aug 21 12:34:34 2018 -0700

    s3:dbwrap_tool: Use cmdline_messaging_context
    
    Initialize the messaging context through cmdline_messaging_context to
    allow access to config in clustered Samba.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 7eeff96b826711b5a8d44ab24603dafcc0343d84)

commit e39945075eec5e0f63636fa1edf67add0b94e780
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:21:51 2018 -0700

    s3:eventlogadm: Use cmdline_messaging_context
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 095123df945270bc51635a19125a7abdfcd4ab80)

commit 0442b1f938469917afdb020024af8859cb74c597
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:18:20 2018 -0700

    s3: ntlm_auth: Use cmdline_messaging_context
    
    Call cmdline_messaging_context to initialize the messaging context
    before accessing clustered Samba config.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 9ed617474f588ceb42c8929ee8a51071a408c219)

commit b71c6d2c279eb195d6111f82b184e7482091f8c6
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:15:02 2018 -0700

    s3:sharesec: Use cmdline_messaging_context
    
    Call cmdline_messasging_context to initialize messaging context before
    accessing clustered Samba config.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit cab8f27bbc927e48c52bac6350325e8ec38092b2)

commit 4881ca3d72bf6660df9d319a66e2dba28dfa8ae0
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:11:11 2018 -0700

    s3:testparm: Use cmdline_messaging_context
    
    Call cmdline_messaging_context to initialize a messaging config before
    accessing clustered Samba config.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit ea7a4ff7ae5ef2b22fb7ef5640d6b946c064cfc3)

commit 212a5bc620a4bc3ea668ea293d700346b94a242e
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:08:21 2018 -0700

    s3:pdbedit: Use cmdline_messaging_context
    
    Initialize the messaging context through cmdline_messaging_context to
    allow access to config in clustered Samba.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 4661537c201acebee991d219d151cb481f56265c)

commit 2e78c3a76ee7eec6d6b4663c8909e362c9815861
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 10 16:29:46 2018 +0200

    s3:messaging: remove unused messaging_init_client()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit f56496b11469f0e9af9ba81cefb796ca1febabb1)

commit 79fe78828b505a0de730955972d7adffa10ee462
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 16:01:00 2018 -0700

    s3:net: Use cmdline_messaging_context
    
    Use cmdline_messaging_context with its error checking instead of open
    coding the same steps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit f2b659e4f518ccb06f221dd028f99883ca1a1847)

commit c2dd495aaac6c7ed3f426c5682b8df4502f21400
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 15:54:11 2018 -0700

    rpcclient: Use cmdline_messaging_context
    
    Use cmdline_messaging_context with its error checking instead of open
    coding the same steps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit dd3ae2ffdc66be4707471bfccf27ef446b5599cb)

commit 55886f7855a6d4b6e9edafce3598f3187a0f0b0a
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 15:46:27 2018 -0700

    s3:smbstatus: Use cmdline_messaging_context
    
    Use cmdline_messaging_context to initialize a messaging context instead
    of open coding the same steps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit d7fa3815a83a50fd9e3d78cac0d5ef3eb79235e5)

commit 49f962f515b50411b181d5cbc9289f4368aa96da
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 15:38:33 2018 -0700

    s3:smbpasswd: Use cmdline_messaging_context
    
    smbpasswd does not use POPT_CREDENTIALS. Call cmdline_messaging_context
    to initialize a messaging_context with proper error checking before
    calling lp_load_global.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 29fd2c2e5ad3c2d44f3629c6b7b4139772fe350c)

commit 8251e95c1ad7481cbc729338156fd027d9305748
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Aug 21 14:58:01 2018 -0700

    test:doc: Skip 'clustering=yes'
    
    As testparm will error out when running clustering=yes as non-root, skip
    this step to avoid a test failure.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (backported from commit 3ecb9ed7b079fc1bf74c311cf5f1684086b36883)

commit 9329a288185162c237f65f8dcaa72e6d52a142c3
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 10 15:26:40 2018 +0200

    s3:popt_common: use cmdline_messaging_context() in popt_common_credentials_callback()
    
    This adds a call to cmdline_messaging_context() to the popt
    popt_common_credentials_callback() hook and ensures that any client tool
    that uses POPT_COMMON_CREDENTIALS gets an implicit messaging context,
    ensuring it doesn't crash in the subsequent lp_load_client() with
    include=registry in a cluster.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 2c63ce94ef3a55ab0aa1aae4f6fee88e29ac2efe)

commit bbdefe855af17e8cbbeb473baf939d2b415e8e09
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 10 10:38:10 2018 +0200

    selftest: pass configfile to pdbedit
    
    This is needed otherwise pdbedit fails to initialize messaging in
    autobuild.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 10e1a6ebb3d95b8a1584a9b90c2584536aa9c96d)

commit b02c52cc513af03af27a4173a623c7e61d9eac17
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 10 08:11:31 2018 +0200

    s3:loadparm: reinit_globals in lp_load_with_registry_shares()
    
    This was set to false in 0e0d77519c27038b30fec92d542198e97be767d9 based
    on the assumption that callers would have no need to call
    lp_load_initial_only() with a later call to lp_load_something().
    
    This is not quite correct, since for accessing registry config on a
    cluster with include=registry, we need messaging up and running which
    *itself* requires loadparm to be initialized to get the statedir,
    lockdir asf. directories.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 3aca3f24d4bdacc11278388934b0b411d518d7b0)

commit b63a2006526b928c4d89b15383eab57a69b57702
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 20 14:44:28 2018 -0700

    s3:lib: Introduce cmdline context wrapper
    
    Command line tools need acccess to the same messaging context provided
    by server_messaging_context, as common code for db_open uses that
    context. We want to have additional checking for command line tools
    without having that code part of the servers. Introduce a wrapper
    library to use for command line tools with the additional checks, that
    then acquires the server_messaging_context.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 8c3b62e6231e62feafacf2a7ee4c9d41cd27a4a1)

commit c247ae0169e572bc22f99a06e71cb0dc54260924
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 13 15:39:08 2018 -0700

    s3:lib: Move popt_common_credentials to separate file
    
    This is only used by command line utilities and has additional
    dependencies. Move to a separate file to contain the dependencies to the
    command line tools.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit b7464fd89bc22b71c82bbaa424bcbfcf947db651)

commit 7791f204c7158650e93eb46abb598141fc6f4d6d
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Aug 13 15:07:20 2018 -0700

    s3/lib:popt_common: Move setup_logging to common callback
    
    The flag is set in the common callback, so be consistent
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit dff1028e8ba4c70e726283c12531853681034014)

commit 240586b6a20d9d94182398d0c03b57c0ee4eac76
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Jul 9 17:11:57 2018 +0200

    s3:lib/server_contexts: make server_event_ctx and server_msg_ctx static
    
    server_event_ctx and server_msg_ctx static shouldn't be accessible from
    outside this compilation unit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit d920a725ee19215190bbccaefd5b426bedc98860)

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

Summary of changes:
 ctdb/include/ctdb_private.h                        |   3 +-
 ctdb/protocol/protocol.h                           |   2 +-
 ctdb/protocol/protocol_api.h                       |   6 -
 ctdb/protocol/protocol_client.c                    |  29 ---
 ctdb/protocol/protocol_control.c                   |  26 --
 ctdb/server/ctdb_control.c                         |   2 +-
 ctdb/server/ctdb_freeze.c                          |  24 +-
 ctdb/server/ctdb_recover.c                         | 211 +---------------
 ctdb/server/ctdb_vacuum.c                          | 280 ++-------------------
 ctdb/tests/simple/69_recovery_resurrect_deleted.sh |  84 +++++++
 ctdb/tests/src/protocol_common_ctdb.c              |  20 --
 examples/fuse/smb2mount.c                          |   2 +-
 examples/fuse/wscript_build                        |   2 +-
 lib/tevent/test_req.c                              |  15 +-
 lib/util/tevent_req_profile.c                      |  85 +++----
 lib/util/tevent_req_profile.h                      |   8 +-
 python/samba/tests/docs.py                         |   3 +-
 source3/client/client.c                            |   2 +-
 source3/include/messages.h                         |   3 -
 source3/include/popt_common.h                      |  10 -
 .../background.h => include/popt_common_cmdline.h} |  46 ++--
 source3/lib/cmdline_contexts.c                     |  70 ++++++
 .../unix_match.h => source3/lib/cmdline_contexts.h |  12 +-
 source3/lib/messages.c                             |   9 -
 source3/lib/popt_common.c                          | 216 +---------------
 source3/lib/popt_common_cmdline.c                  | 249 ++++++++++++++++++
 source3/lib/server_contexts.c                      |   4 +-
 source3/param/loadparm.c                           |   2 +-
 source3/rpcclient/cmd_spoolss.c                    |   2 +-
 source3/rpcclient/rpcclient.c                      |  30 +--
 source3/rpcclient/wscript_build                    |   2 +-
 source3/smbd/close.c                               |   4 +
 source3/smbd/smb2_server.c                         |  15 +-
 source3/utils/dbwrap_tool.c                        |   3 +
 source3/utils/eventlogadm.c                        |   4 +
 source3/utils/net.c                                |  31 +--
 source3/utils/ntlm_auth.c                          |   3 +
 source3/utils/pdbedit.c                            |   3 +
 source3/utils/regedit.c                            |   2 +-
 source3/utils/sharesec.c                           |   2 +
 source3/utils/smbcacls.c                           |   2 +-
 source3/utils/smbcontrol.c                         |  19 +-
 source3/utils/smbcquotas.c                         |   2 +-
 source3/utils/smbget.c                             |   5 +-
 source3/utils/smbpasswd.c                          |  17 +-
 source3/utils/smbtree.c                            |   2 +-
 source3/utils/status.c                             |  25 +-
 source3/utils/testparm.c                           |   3 +
 source3/utils/wscript_build                        |  34 ++-
 source3/wscript_build                              |  15 +-
 source4/torture/smb2/session.c                     |  50 +++-
 testprogs/blackbox/test_pdbtest.sh                 |   8 +-
 52 files changed, 712 insertions(+), 996 deletions(-)
 create mode 100755 ctdb/tests/simple/69_recovery_resurrect_deleted.sh
 copy source3/{lib/background.h => include/popt_common_cmdline.h} (50%)
 create mode 100644 source3/lib/cmdline_contexts.c
 copy lib/util/unix_match.h => source3/lib/cmdline_contexts.h (72%)
 create mode 100644 source3/lib/popt_common_cmdline.c


Changeset truncated at 500 lines:

diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index b3d2e14..ea00bb1 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -386,6 +386,7 @@ struct ctdb_db_context {
 	uint32_t freeze_transaction_id;
 	uint32_t generation;
 
+	bool invalid_records;
 	bool push_started;
 	void *push_state;
 
@@ -820,8 +821,6 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
 
 int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb,
 					TDB_DATA indata, TDB_DATA *outdata);
-int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
-				     TDB_DATA indata, TDB_DATA *outdata);
 
 int32_t ctdb_control_get_capabilities(struct ctdb_context *ctdb,
 				      TDB_DATA *outdata);
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index 6abd015..b868553 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -355,7 +355,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_SET_DB_STICKY           = 133,
 		    CTDB_CONTROL_RELOAD_PUBLIC_IPS       = 134,
 		    CTDB_CONTROL_TRAVERSE_ALL_EXT        = 135,
-		    CTDB_CONTROL_RECEIVE_RECORDS         = 136,
+		    CTDB_CONTROL_RECEIVE_RECORDS         = 136, /* obsolete */
 		    CTDB_CONTROL_IPREALLOCATED           = 137,
 		    CTDB_CONTROL_GET_RUNSTATE            = 138,
 		    CTDB_CONTROL_DB_DETACH               = 139,
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index 1cd5d7d..6104c10 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -530,12 +530,6 @@ int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_receive_records(struct ctdb_req_control *request,
-				      struct ctdb_rec_buffer *recbuf);
-int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
-				       TALLOC_CTX *mem_ctx,
-				       struct ctdb_rec_buffer **recbuf);
-
 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
 
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index a18af08..9aa32a9 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -1948,35 +1948,6 @@ int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply)
 
 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
 
-/* CTDB_CONTROL_RECEIVE_RECORDS */
-
-void ctdb_req_control_receive_records(struct ctdb_req_control *request,
-				      struct ctdb_rec_buffer *recbuf)
-{
-	request->opcode = CTDB_CONTROL_RECEIVE_RECORDS;
-	request->pad = 0;
-	request->srvid = 0;
-	request->client_id = 0;
-	request->flags = 0;
-
-	request->rdata.opcode = CTDB_CONTROL_RECEIVE_RECORDS;
-	request->rdata.data.recbuf = recbuf;
-}
-
-int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
-				       TALLOC_CTX *mem_ctx,
-				       struct ctdb_rec_buffer **recbuf)
-{
-	if (reply->rdata.opcode != CTDB_CONTROL_RECEIVE_RECORDS) {
-		return EPROTO;
-	}
-
-	if (reply->status == 0) {
-		*recbuf = talloc_steal(mem_ctx, reply->rdata.data.recbuf);
-	}
-	return reply->status;
-}
-
 /* CTDB_CONTROL_IPREALLOCATED */
 
 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request)
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index 12a78e1..0b88b5c 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -360,10 +360,6 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 		len = ctdb_traverse_all_ext_len(cd->data.traverse_all_ext);
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		len = ctdb_rec_buffer_len(cd->data.recbuf);
-		break;
-
 	case CTDB_CONTROL_IPREALLOCATED:
 		break;
 
@@ -660,10 +656,6 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
 					   &np);
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
-		break;
-
 	case CTDB_CONTROL_DB_DETACH:
 		ctdb_uint32_push(&cd->data.db_id, buf, &np);
 		break;
@@ -988,11 +980,6 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
 						 &np);
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		ret = ctdb_rec_buffer_pull(buf, buflen, mem_ctx,
-					   &cd->data.recbuf, &np);
-		break;
-
 	case CTDB_CONTROL_DB_DETACH:
 		ret = ctdb_uint32_pull(buf, buflen, &cd->data.db_id, &np);
 		break;
@@ -1368,10 +1355,6 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
 	case CTDB_CONTROL_TRAVERSE_ALL_EXT:
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		len = ctdb_rec_buffer_len(cd->data.recbuf);
-		break;
-
 	case CTDB_CONTROL_IPREALLOCATED:
 		break;
 
@@ -1562,10 +1545,6 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd,
 		ctdb_db_statistics_push(cd->data.dbstats, buf, &np);
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
-		break;
-
 	case CTDB_CONTROL_GET_RUNSTATE:
 		ctdb_uint32_push(&cd->data.runstate, buf, &np);
 		break;
@@ -1753,11 +1732,6 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen,
 					      &cd->data.dbstats, &np);
 		break;
 
-	case CTDB_CONTROL_RECEIVE_RECORDS:
-		ret = ctdb_rec_buffer_pull(buf, buflen, mem_ctx,
-					   &cd->data.recbuf, &np);
-		break;
-
 	case CTDB_CONTROL_GET_RUNSTATE:
 		ret = ctdb_uint32_pull(buf, buflen, &cd->data.runstate, &np);
 		break;
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 848010e..c260b92 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -650,7 +650,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 		return ctdb_control_reload_public_ips(ctdb, c, async_reply);
 
 	case CTDB_CONTROL_RECEIVE_RECORDS:
-		return ctdb_control_receive_records(ctdb, indata, outdata);
+		return control_not_implemented("RECEIVE_RECORDS", NULL);
 
 	case CTDB_CONTROL_DB_DETACH:
 		return ctdb_control_db_detach(ctdb, indata, client_id);
diff --git a/ctdb/server/ctdb_freeze.c b/ctdb/server/ctdb_freeze.c
index c41fc7d..10841ef 100644
--- a/ctdb/server/ctdb_freeze.c
+++ b/ctdb/server/ctdb_freeze.c
@@ -140,6 +140,9 @@ static int ctdb_db_freeze_handle_destructor(struct ctdb_db_freeze_handle *h)
 	ctdb_db->freeze_mode = CTDB_FREEZE_NONE;
 	ctdb_db->freeze_handle = NULL;
 
+	/* Clear invalid records flag */
+	ctdb_db->invalid_records = false;
+
 	talloc_free(h->lreq);
 	return 0;
 }
@@ -394,6 +397,19 @@ static int db_freeze_waiter_destructor(struct ctdb_db_freeze_waiter *w)
 }
 
 /**
+ * Invalidate the records in the database.
+ * This only applies to volatile databases.
+ */
+static int db_invalidate(struct ctdb_db_context *ctdb_db, void *private_data)
+{
+	if (ctdb_db_volatile(ctdb_db)) {
+		ctdb_db->invalid_records = true;
+	}
+
+	return 0;
+}
+
+/**
  * Count the number of databases
  */
 static int db_count(struct ctdb_db_context *ctdb_db, void *private_data)
@@ -436,13 +452,17 @@ static int db_freeze(struct ctdb_db_context *ctdb_db, void *private_data)
 }
 
 /*
-  start the freeze process for a certain priority
+  start the freeze process for all databases
+  This is only called from ctdb_control_freeze(), which is called
+  only on node becoming INACTIVE.  So mark the records invalid.
  */
 static void ctdb_start_freeze(struct ctdb_context *ctdb)
 {
 	struct ctdb_freeze_handle *h;
 	int ret;
 
+	ctdb_db_iterator(ctdb, db_invalidate, NULL);
+
 	if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
 		int count = 0;
 
@@ -534,6 +554,8 @@ static int ctdb_freeze_waiter_destructor(struct ctdb_freeze_waiter *w)
 
 /*
   freeze all the databases
+  This control is only used when freezing database on node becoming INACTIVE.
+  So mark the records invalid in ctdb_start_freeze().
  */
 int32_t ctdb_control_freeze(struct ctdb_context *ctdb,
 			    struct ctdb_req_control_old *c, bool *async_reply)
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index fc64037b..f05052e 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -279,6 +279,11 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
 				     ctdb_db->db_name, ctdb_db->unhealthy_reason));
 	}
 
+	/* If the records are invalid, we are done */
+	if (ctdb_db->invalid_records) {
+		goto done;
+	}
+
 	if (ctdb_lockdb_mark(ctdb_db) != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entire db - failing\n"));
 		return -1;
@@ -293,6 +298,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
 
 	ctdb_lockdb_unmark(ctdb_db);
 
+done:
 	outdata->dptr = (uint8_t *)params.pulldata;
 	outdata->dsize = params.len;
 
@@ -388,6 +394,11 @@ int32_t ctdb_control_db_pull(struct ctdb_context *ctdb,
 	state.srvid = pulldb_ext->srvid;
 	state.num_records = 0;
 
+	/* If the records are invalid, we are done */
+	if (ctdb_db->invalid_records) {
+		goto done;
+	}
+
 	if (ctdb_lockdb_mark(ctdb_db) != 0) {
 		DEBUG(DEBUG_ERR,
 		      (__location__ " Failed to get lock on entire db - failing\n"));
@@ -422,6 +433,7 @@ int32_t ctdb_control_db_pull(struct ctdb_context *ctdb,
 
 	ctdb_lockdb_unmark(ctdb_db);
 
+done:
 	outdata->dptr = talloc_size(outdata, sizeof(uint32_t));
 	if (outdata->dptr == NULL) {
 		DEBUG(DEBUG_ERR, (__location__ " Memory allocation error\n"));
@@ -1318,205 +1330,6 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
 	return 0;
 }
 
-/**
- * Store a record as part of the vacuum process:
- * This is called from the RECEIVE_RECORD control which
- * the lmaster uses to send the current empty copy
- * to all nodes for storing, before it lets the other
- * nodes delete the records in the second phase with
- * the TRY_DELETE_RECORDS control.
- *
- * Only store if we are not lmaster or dmaster, and our
- * rsn is <= the provided rsn. Use non-blocking locks.
- *
- * return 0 if the record was successfully stored.
- * return !0 if the record still exists in the tdb after returning.
- */
-static int store_tdb_record(struct ctdb_context *ctdb,
-			    struct ctdb_db_context *ctdb_db,
-			    struct ctdb_rec_data_old *rec)
-{
-	TDB_DATA key, data, data2;
-	struct ctdb_ltdb_header *hdr, *hdr2;
-	int ret;
-
-	key.dsize = rec->keylen;
-	key.dptr = &rec->data[0];
-	data.dsize = rec->datalen;
-	data.dptr = &rec->data[rec->keylen];
-
-	if (ctdb_lmaster(ctdb, &key) == ctdb->pnn) {
-		DEBUG(DEBUG_INFO, (__location__ " Called store_tdb_record "
-				   "where we are lmaster\n"));
-		return -1;
-	}
-
-	if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
-		DEBUG(DEBUG_ERR, (__location__ " Bad record size\n"));
-		return -1;
-	}
-
-	hdr = (struct ctdb_ltdb_header *)data.dptr;
-
-	/* use a non-blocking lock */
-	if (tdb_chainlock_nonblock(ctdb_db->ltdb->tdb, key) != 0) {
-		DEBUG(DEBUG_INFO, (__location__ " Failed to lock chain in non-blocking mode\n"));
-		return -1;
-	}
-
-	data2 = tdb_fetch(ctdb_db->ltdb->tdb, key);
-	if (data2.dptr == NULL || data2.dsize < sizeof(struct ctdb_ltdb_header)) {
-		if (tdb_store(ctdb_db->ltdb->tdb, key, data, 0) == -1) {
-			DEBUG(DEBUG_ERR, (__location__ "Failed to store record\n"));
-			ret = -1;
-			goto done;
-		}
-		DEBUG(DEBUG_INFO, (__location__ " Stored record\n"));
-		ret = 0;
-		goto done;
-	}
-
-	hdr2 = (struct ctdb_ltdb_header *)data2.dptr;
-
-	if (hdr2->rsn > hdr->rsn) {
-		DEBUG(DEBUG_INFO, (__location__ " Skipping record with "
-				   "rsn=%llu - called with rsn=%llu\n",
-				   (unsigned long long)hdr2->rsn,
-				   (unsigned long long)hdr->rsn));
-		ret = -1;
-		goto done;
-	}
-
-	/* do not allow vacuuming of records that have readonly flags set. */
-	if (hdr->flags & CTDB_REC_RO_FLAGS) {
-		DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly "
-				  "flags set\n"));
-		ret = -1;
-		goto done;
-	}
-	if (hdr2->flags & CTDB_REC_RO_FLAGS) {
-		DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly "
-				  "flags set\n"));
-		ret = -1;
-		goto done;
-	}
-
-	if (hdr2->dmaster == ctdb->pnn) {
-		DEBUG(DEBUG_INFO, (__location__ " Attempted to store record "
-				   "where we are the dmaster\n"));
-		ret = -1;
-		goto done;
-	}
-
-	if (tdb_store(ctdb_db->ltdb->tdb, key, data, 0) != 0) {
-		DEBUG(DEBUG_INFO,(__location__ " Failed to store record\n"));
-		ret = -1;
-		goto done;
-	}
-
-	ret = 0;
-
-done:
-	tdb_chainunlock(ctdb_db->ltdb->tdb, key);
-	free(data2.dptr);
-	return  ret;
-}
-
-
-
-/**
- * Try to store all these records as part of the vacuuming process
- * and return the records we failed to store.
- */
-int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
-				     TDB_DATA indata, TDB_DATA *outdata)
-{
-	struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
-	struct ctdb_db_context *ctdb_db;
-	int i;
-	struct ctdb_rec_data_old *rec;
-	struct ctdb_marshall_buffer *records;
-
-	if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
-		DEBUG(DEBUG_ERR,
-		      (__location__ " invalid data in receive_records\n"));
-		return -1;
-	}
-
-	ctdb_db = find_ctdb_db(ctdb, reply->db_id);
-	if (!ctdb_db) {
-		DEBUG(DEBUG_ERR, (__location__ " Unknown db 0x%08x\n",
-				  reply->db_id));
-		return -1;
-	}
-
-	DEBUG(DEBUG_DEBUG, ("starting receive_records of %u records for "
-			    "dbid 0x%x\n", reply->count, reply->db_id));
-
-	/* create a blob to send back the records we could not store */
-	records = (struct ctdb_marshall_buffer *)
-			talloc_zero_size(outdata,
-				offsetof(struct ctdb_marshall_buffer, data));
-	if (records == NULL) {
-		DEBUG(DEBUG_ERR, (__location__ " Out of memory\n"));
-		return -1;
-	}
-	records->db_id = ctdb_db->db_id;
-
-	rec = (struct ctdb_rec_data_old *)&reply->data[0];
-	for (i=0; i<reply->count; i++) {
-		TDB_DATA key, data;
-
-		key.dptr = &rec->data[0];
-		key.dsize = rec->keylen;
-		data.dptr = &rec->data[key.dsize];
-		data.dsize = rec->datalen;
-
-		if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
-			DEBUG(DEBUG_CRIT, (__location__ " bad ltdb record "
-					   "in indata\n"));
-			talloc_free(records);
-			return -1;
-		}
-
-		/*
-		 * If we can not store the record we must add it to the reply
-		 * so the lmaster knows it may not purge this record.
-		 */
-		if (store_tdb_record(ctdb, ctdb_db, rec) != 0) {
-			size_t old_size;
-			struct ctdb_ltdb_header *hdr;
-
-			hdr = (struct ctdb_ltdb_header *)data.dptr;
-			data.dptr += sizeof(*hdr);
-			data.dsize -= sizeof(*hdr);
-
-			DEBUG(DEBUG_INFO, (__location__ " Failed to store "
-					   "record with hash 0x%08x in vacuum "
-					   "via RECEIVE_RECORDS\n",
-					   ctdb_hash(&key)));
-
-			old_size = talloc_get_size(records);
-			records = talloc_realloc_size(outdata, records,
-						      old_size + rec->length);
-			if (records == NULL) {
-				DEBUG(DEBUG_ERR, (__location__ " Failed to "
-						  "expand\n"));
-				return -1;
-			}
-			records->count++;
-			memcpy(old_size+(uint8_t *)records, rec, rec->length);
-		}
-
-		rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
-	}
-
-	*outdata = ctdb_marshall_finish(records);
-
-	return 0;
-}
-
-
 /*
   report capabilities
  */
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index e749116..2194b7f 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -107,6 +107,7 @@ struct delete_record_data {
 	struct ctdb_context *ctdb;
 	struct ctdb_db_context *ctdb_db;
 	struct ctdb_ltdb_header hdr;
+	uint32_t remote_fail_count;
 	TDB_DATA key;
 	uint8_t keydata[1];
 };


-- 
Samba Shared Repository



More information about the samba-cvs mailing list