[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Tue Apr 28 10:47:02 UTC 2020
The branch, master has been updated
via 6233929f722 lib: Remove unused elements from ctdbd_connection
via c949d15ad59 lib: Nobody sets ctdbd_connection->fde anymore, remove it
via ca063446cf9 lib: Remove unused ctdbd_setup_fde() and callees
via 296114cf47a lib: Use ctdbd_req_send/recv in ctdb_parse_send/recv
via 7a7d56c5624 torture3: Test ctdb_req_send/recv
via e1418589b05 lib: Add ctdbd_req_send/recv
via 177de8ec3f6 lib: Add ctdbd_prep_hdr_next_reqid()
via c70b8f069bb lib: Add ctdbd_init_async_connection()
via af75d0afd0a selftest: Run local-dbwrap-ctdb1 test
via 262a7aa7a68 torture3: Rename LOCAL-DBWRAP-CTDB->LOCAL-DBWRAP-CTDB1
via 6829e736272 torture3: Fix the local-dbwrap-ctdb test
via 684d3d06ce9 torture3: test readdir timestamp
via b57bb1fe227 libsmb: Add cli_setfileinfo_ext()
via 9b63cbd7895 libsmb: Factor out prep_basic_information_buf()
via d9ccd853c30 ctdb: Implement CTDB_CONTROL_ECHO_DATA
via bdabf781222 ctdb-protocol: Add marshalling for control ECHO_DATA
via 6f56f45639e ctdb-protocol: Add marshalling for struct ctdb_echo_data
via 4f3db63d5e6 ctdb-protocol: Add new control CTDB_CONTROL_ECHO_DATA
via 861dd8c48a5 ctdb: Fix duplicate ;;
from 1f97aeac6b8 traffic_packets: fix SyntaxWarning: "is" with a literal
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6233929f722f656c41752eb1f46acb39d4511690
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 24 14:35:51 2020 +0100
lib: Remove unused elements from ctdbd_connection
Nobody set them, only the destructor referenced them
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Apr 28 10:46:22 UTC 2020 on sn-devel-184
commit c949d15ad5955e2f42963684210b98131a970eae
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 24 14:33:28 2020 +0100
lib: Nobody sets ctdbd_connection->fde anymore, remove it
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit ca063446cf977f455daa4320e9692cf22f0c0a4d
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 24 14:32:06 2020 +0100
lib: Remove unused ctdbd_setup_fde() and callees
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 296114cf47a38958f7c754b9cc1c26e59205bb71
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 11 11:03:06 2020 +0100
lib: Use ctdbd_req_send/recv in ctdb_parse_send/recv
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 7a7d56c5624cd8c711f0ae8619ed07f6bae8982c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 12 16:20:50 2020 +0100
torture3: Test ctdb_req_send/recv
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e1418589b05895f3cbf52d2a5ce43bdda0bf14d6
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 20 13:58:21 2020 +0100
lib: Add ctdbd_req_send/recv
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 177de8ec3f6f62243f59501db921b54034be040d
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 20 13:46:13 2020 +0100
lib: Add ctdbd_prep_hdr_next_reqid()
Preparation for generic ctdb_req_send/recv: No need to expose
ctdbd_next_reqid(), do basic preparations of a ctdb_req_header
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit c70b8f069bb4c9f305556bc59e0466e312ad43bf
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 12 16:05:58 2020 +0100
lib: Add ctdbd_init_async_connection()
Prepare for ctdb_req_send/recv doing tevent_req based async ctdb
requests
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit af75d0afd0a560264244dc1495afb488a59ce285
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 23 13:03:35 2020 +0100
selftest: Run local-dbwrap-ctdb1 test
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 262a7aa7a68b77d2b7f6405dc99fa380d2aed216
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 23 13:02:55 2020 +0100
torture3: Rename LOCAL-DBWRAP-CTDB->LOCAL-DBWRAP-CTDB1
There will be more
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 6829e73627240850b3b45df2fdf3e5aa2cbbcc50
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 23 13:01:29 2020 +0100
torture3: Fix the local-dbwrap-ctdb test
We need to O_CREAT the database when connecting
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 684d3d06ce9f915ef8cc7bd0a8f938fd50911939
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 25 12:20:39 2020 +0100
torture3: test readdir timestamp
Create -o files per -N client connections, set a specific timestamp, then write
a bit. This leads to the locking.tdb dmasters to be spread across all nodes.
Then list from one node. This makes sure that the async share mode fetch works
right.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit b57bb1fe227e5a9d0c52665baa3f64f8f6da7892
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 30 17:54:28 2020 +0200
libsmb: Add cli_setfileinfo_ext()
Analogue to cli_setpathinfo_ext()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 9b63cbd7895c5399a36099f2b94aee25d169440f
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 30 16:47:52 2020 +0200
libsmb: Factor out prep_basic_information_buf()
Will be used in cli_setfileinfo_ext next
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit d9ccd853c306a533699ea1679862f7b274da001e
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 18 11:31:14 2020 +0100
ctdb: Implement CTDB_CONTROL_ECHO_DATA
Testing control: 4 bytes msec delay plus a blob, return the request after the
delay. This is an enhanced "ping" which can be used to test asynchronous
clients.
Doesn't have the full protocol implementation yet
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
commit bdabf7812223dc0c365fd13aa53d35d10edcdece
Author: Volker Lendecke <vl at samba.org>
Date: Tue Apr 7 17:26:26 2020 +0200
ctdb-protocol: Add marshalling for control ECHO_DATA
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
commit 6f56f45639e6404161da425bcd2654624907a439
Author: Volker Lendecke <vl at samba.org>
Date: Tue Apr 7 16:44:58 2020 +0200
ctdb-protocol: Add marshalling for struct ctdb_echo_data
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
commit 4f3db63d5e68382fff9196ce6cf9976501519fdc
Author: Volker Lendecke <vl at samba.org>
Date: Tue Apr 7 15:17:42 2020 +0200
ctdb-protocol: Add new control CTDB_CONTROL_ECHO_DATA
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
commit 861dd8c48a5f680967f07378899443ce42237f31
Author: Volker Lendecke <vl at samba.org>
Date: Tue Apr 7 21:48:24 2020 +0200
ctdb: Fix duplicate ;;
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
ctdb/protocol/protocol.h | 8 +
ctdb/protocol/protocol_api.h | 4 +
ctdb/protocol/protocol_client.c | 24 +
ctdb/protocol/protocol_control.c | 32 ++
ctdb/protocol/protocol_debug.c | 1 +
ctdb/protocol/protocol_private.h | 10 +
ctdb/protocol/protocol_types.c | 74 ++-
ctdb/server/ctdb_control.c | 87 +++
ctdb/tests/UNIT/cunit/protocol_test_101.sh | 2 +-
ctdb/tests/src/protocol_common.c | 13 +
ctdb/tests/src/protocol_common.h | 4 +
ctdb/tests/src/protocol_common_ctdb.c | 20 +
ctdb/tests/src/protocol_ctdb_test.c | 2 +-
ctdb/tests/src/protocol_types_test.c | 2 +
source3/include/ctdbd_conn.h | 25 +-
source3/lib/ctdbd_conn.c | 847 ++++++++++-------------------
source3/lib/dbwrap/dbwrap_ctdb.c | 16 +-
source3/libsmb/clirap.c | 184 ++++++-
source3/libsmb/clirap.h | 19 +
source3/selftest/tests.py | 30 +
source3/torture/proto.h | 4 +-
source3/torture/test_ctdbd_conn.c | 312 +++++++++++
source3/torture/test_dbwrap_ctdb.c | 15 +-
source3/torture/test_readdir_timestamp.c | 533 ++++++++++++++++++
source3/torture/torture.c | 14 +-
source3/wscript_build | 8 +-
26 files changed, 1695 insertions(+), 595 deletions(-)
create mode 100644 source3/torture/test_ctdbd_conn.c
create mode 100644 source3/torture/test_readdir_timestamp.c
Changeset truncated at 500 lines:
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index 04a651018be..35543a67cf9 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -375,6 +375,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_TUNNEL_DEREGISTER = 153,
CTDB_CONTROL_VACUUM_FETCH = 154,
CTDB_CONTROL_DB_VACUUM = 155,
+ CTDB_CONTROL_ECHO_DATA = 156,
};
#define MAX_COUNT_BUCKETS 16
@@ -859,6 +860,11 @@ struct ctdb_db_vacuum {
};
+struct ctdb_echo_data {
+ uint32_t timeout;
+ TDB_DATA buf;
+};
+
struct ctdb_req_control_data {
uint32_t opcode;
union {
@@ -897,6 +903,7 @@ struct ctdb_req_control_data {
struct ctdb_traverse_all_ext *traverse_all_ext;
struct ctdb_pid_srvid *pid_srvid;
struct ctdb_db_vacuum *db_vacuum;
+ struct ctdb_echo_data *echo_data;
} data;
};
@@ -932,6 +939,7 @@ struct ctdb_reply_control_data {
enum ctdb_runstate runstate;
uint32_t num_records;
int tdb_flags;
+ struct ctdb_echo_data *echo_data;
} data;
};
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index c2cd4a76289..bdb4bc0e2ea 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -611,6 +611,10 @@ void ctdb_req_control_db_vacuum(struct ctdb_req_control *request,
struct ctdb_db_vacuum *db_vacuum);
int ctdb_reply_control_db_vacuum(struct ctdb_reply_control *reply);
+void ctdb_req_control_echo_data(struct ctdb_req_control *request,
+ struct ctdb_echo_data *echo_data);
+int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply);
+
/* From protocol/protocol_debug.c */
void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index 6c5180d6d6d..cde544feb52 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -2385,3 +2385,27 @@ int ctdb_reply_control_db_vacuum(struct ctdb_reply_control *reply)
return reply->status;
}
+
+/* CTDB_CONTROL_ECHO_DATA */
+
+void ctdb_req_control_echo_data(struct ctdb_req_control *request,
+ struct ctdb_echo_data *echo_data)
+{
+ request->opcode = CTDB_CONTROL_ECHO_DATA;
+ request->pad = 0;
+ request->srvid = 0;
+ request->client_id = 0;
+ request->flags = 0;
+
+ request->rdata.opcode = CTDB_CONTROL_ECHO_DATA;
+ request->rdata.data.echo_data = echo_data;
+}
+
+int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply)
+{
+ if (reply->rdata.opcode != CTDB_CONTROL_ECHO_DATA) {
+ return EPROTO;
+ }
+
+ return reply->status;
+}
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index a25c9b1cfe0..4fd5a5a7d4d 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -415,6 +415,10 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
case CTDB_CONTROL_DB_VACUUM:
len = ctdb_db_vacuum_len(cd->data.db_vacuum);
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ len = ctdb_echo_data_len(cd->data.echo_data);
+ break;
}
return len;
@@ -698,6 +702,10 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
case CTDB_CONTROL_DB_VACUUM:
ctdb_db_vacuum_push(cd->data.db_vacuum, buf, &np);
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ ctdb_echo_data_push(cd->data.echo_data, buf, &np);
+ break;
}
*npush = np;
@@ -1035,6 +1043,14 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
&cd->data.db_vacuum,
&np);
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ ret = ctdb_echo_data_pull(buf,
+ buflen,
+ mem_ctx,
+ &cd->data.echo_data,
+ &np);
+ break;
}
if (ret != 0) {
@@ -1398,6 +1414,10 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
case CTDB_CONTROL_DB_VACUUM:
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ len = ctdb_echo_data_len(cd->data.echo_data);
+ break;
}
return len;
@@ -1558,6 +1578,10 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd,
case CTDB_CONTROL_DB_VACUUM:
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ ctdb_echo_data_push(cd->data.echo_data, buf, &np);
+ break;
}
*npush = np;
@@ -1748,6 +1772,14 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen,
case CTDB_CONTROL_DB_VACUUM:
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ ret = ctdb_echo_data_pull(buf,
+ buflen,
+ mem_ctx,
+ &cd->data.echo_data,
+ &np);
+ break;
}
if (ret != 0) {
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index 3fe78b13162..56f14e32b09 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -244,6 +244,7 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
{ CTDB_CONTROL_TUNNEL_DEREGISTER, "TUNNEL_DEREGISTER" },
{ CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" },
{ CTDB_CONTROL_DB_VACUUM, "DB_VACUUM" },
+ { CTDB_CONTROL_ECHO_DATA, "ECHO_DATA" },
{ MAP_END, "" },
};
diff --git a/ctdb/protocol/protocol_private.h b/ctdb/protocol/protocol_private.h
index b151e64ef09..cbbba394df7 100644
--- a/ctdb/protocol/protocol_private.h
+++ b/ctdb/protocol/protocol_private.h
@@ -93,6 +93,16 @@ int ctdb_db_vacuum_pull(uint8_t *buf,
struct ctdb_db_vacuum **out,
size_t *npull);
+size_t ctdb_echo_data_len(struct ctdb_echo_data *in);
+void ctdb_echo_data_push(struct ctdb_echo_data *in,
+ uint8_t *buf,
+ size_t *npush);
+int ctdb_echo_data_pull(uint8_t *buf,
+ size_t buflen,
+ TALLOC_CTX *mem_ctx,
+ struct ctdb_echo_data **out,
+ size_t *npull);
+
size_t ctdb_traverse_start_len(struct ctdb_traverse_start *in);
void ctdb_traverse_start_push(struct ctdb_traverse_start *in, uint8_t *buf,
size_t *npush);
diff --git a/ctdb/protocol/protocol_types.c b/ctdb/protocol/protocol_types.c
index fb288635234..0eb1923207e 100644
--- a/ctdb/protocol/protocol_types.c
+++ b/ctdb/protocol/protocol_types.c
@@ -1281,7 +1281,7 @@ int ctdb_db_vacuum_pull(uint8_t *buf,
&val->db_id,
&np);
if (ret != 0) {
- goto fail;;
+ goto fail;
}
offset += np;
@@ -1303,6 +1303,78 @@ fail:
return ret;
}
+size_t ctdb_echo_data_len(struct ctdb_echo_data *in)
+{
+ /*
+ * No overflow check, none of the routines in this file do it
+ * and there's no way to report it anyway.
+ */
+ return ctdb_uint32_len(&in->timeout) + ctdb_tdb_datan_len(&in->buf);
+}
+
+void ctdb_echo_data_push(struct ctdb_echo_data *in,
+ uint8_t *buf,
+ size_t *npush)
+{
+ size_t offset = 0, np;
+
+ /*
+ * No overflow check, none of the routines in this file do it
+ * and there's no way to report it anyway.
+ */
+
+ ctdb_uint32_push(&in->timeout, buf+offset, &np);
+ offset += np;
+
+ ctdb_tdb_datan_push(&in->buf, buf+offset, &np);
+ offset += np;
+
+ *npush = offset;
+}
+
+int ctdb_echo_data_pull(uint8_t *buf,
+ size_t buflen,
+ TALLOC_CTX *mem_ctx,
+ struct ctdb_echo_data **out,
+ size_t *npull)
+{
+ struct ctdb_echo_data *val;
+ size_t offset = 0, np;
+ int ret;
+
+ val = talloc(mem_ctx, struct ctdb_echo_data);
+ if (val == NULL) {
+ return ENOMEM;
+ }
+
+ ret = ctdb_uint32_pull(buf+offset,
+ buflen-offset,
+ &val->timeout,
+ &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+
+ ret = ctdb_tdb_datan_pull(buf+offset,
+ buflen-offset,
+ val,
+ &val->buf,
+ &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+
+ *out = val;
+ *npull = offset;
+ return 0;
+
+fail:
+ talloc_free(val);
+ return ret;
+}
+
size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header *in)
{
return ctdb_uint64_len(&in->rsn) +
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index d162268a178..95f3b175934 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -89,6 +89,90 @@ static int32_t control_not_implemented(const char *unsupported,
return -1;
}
+struct ctdb_echo_data_state {
+ struct ctdb_context *ctdb;
+ struct ctdb_req_control_old *c;
+ struct ctdb_echo_data *data;
+};
+
+static void ctdb_echo_data_timeout(
+ struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval now,
+ void *private_data);
+
+static int32_t ctdb_control_echo_data(
+ struct ctdb_context *ctdb,
+ struct ctdb_req_control_old *c,
+ TDB_DATA indata,
+ bool *async_reply)
+{
+ struct ctdb_echo_data_state *state = NULL;
+ struct tevent_timer *te = NULL;
+ uint32_t delay = 0;
+ size_t np = 0;
+ int ret;
+
+ state = talloc_zero(ctdb, struct ctdb_echo_data_state);
+ CTDB_NO_MEMORY(ctdb, state);
+ state->ctdb = ctdb;
+
+ ret = ctdb_echo_data_pull(
+ indata.dptr, indata.dsize, state, &state->data, &np);
+ if (ret != 0) {
+ DBG_DEBUG("ctdb_echo_data_pull failed: %s\n",
+ strerror(ret));
+ TALLOC_FREE(state);
+ return -1;
+ }
+
+ te = tevent_add_timer(
+ ctdb->ev,
+ state,
+ timeval_current_ofs_msec(delay),
+ ctdb_echo_data_timeout,
+ state);
+ if (te == NULL) {
+ DBG_DEBUG("tevent_add_timer failed\n");
+ TALLOC_FREE(state);
+ return -1;
+ }
+
+ state->c = talloc_move(state, &c);
+ *async_reply = true;
+
+ return 0;
+}
+
+static void ctdb_echo_data_timeout(
+ struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval now,
+ void *private_data)
+{
+ struct ctdb_echo_data_state *state = talloc_get_type_abort(
+ private_data, struct ctdb_echo_data_state);
+ size_t len = ctdb_echo_data_len(state->data);
+ uint8_t *buf = NULL;
+ size_t np;
+ TDB_DATA data;
+
+ DBG_DEBUG("reqid=%"PRIu32" len=%zu\n", state->c->hdr.reqid, len);
+
+ buf = talloc_array(state, uint8_t, len);
+ if (buf == NULL) {
+ DBG_WARNING("talloc_array(%zu) failed\n", len);
+ goto done;
+ }
+ ctdb_echo_data_push(state->data, buf, &np);
+ data = (TDB_DATA) { .dptr = buf, .dsize = np };
+
+ ctdb_request_control_reply(state->ctdb, state->c, &data, 0, NULL);
+
+done:
+ TALLOC_FREE(state);
+}
+
/*
process a control request
*/
@@ -740,6 +824,9 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
CHECK_CONTROL_DATA_SIZE(ctdb_db_vacuum_len(&db_vacuum));
return ctdb_control_db_vacuum(ctdb, c, indata, async_reply);
}
+ case CTDB_CONTROL_ECHO_DATA: {
+ return ctdb_control_echo_data(ctdb, c, indata, async_reply);
+ }
default:
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
diff --git a/ctdb/tests/UNIT/cunit/protocol_test_101.sh b/ctdb/tests/UNIT/cunit/protocol_test_101.sh
index 6b07dc017ba..79dfabeb801 100755
--- a/ctdb/tests/UNIT/cunit/protocol_test_101.sh
+++ b/ctdb/tests/UNIT/cunit/protocol_test_101.sh
@@ -2,7 +2,7 @@
. "${TEST_SCRIPTS_DIR}/unit.sh"
-last_control=155
+last_control=156
generate_control_output ()
{
diff --git a/ctdb/tests/src/protocol_common.c b/ctdb/tests/src/protocol_common.c
index 2030b4bb5e5..212c23ce965 100644
--- a/ctdb/tests/src/protocol_common.c
+++ b/ctdb/tests/src/protocol_common.c
@@ -323,6 +323,19 @@ void verify_ctdb_db_vacuum(struct ctdb_db_vacuum *p1,
verify_ctdb_bool(&p1->full_vacuum_run, &p2->full_vacuum_run);
}
+void fill_ctdb_echo_data(TALLOC_CTX *mem_ctx, struct ctdb_echo_data *p)
+{
+ fill_ctdb_uint32(&p->timeout);
+ fill_tdb_data(mem_ctx, &p->buf);
+}
+
+void verify_ctdb_echo_data(struct ctdb_echo_data *p1,
+ struct ctdb_echo_data *p2)
+{
+ verify_ctdb_uint32(&p1->timeout, &p2->timeout);
+ verify_tdb_data(&p1->buf, &p2->buf);
+}
+
void fill_ctdb_ltdb_header(struct ctdb_ltdb_header *p)
{
p->rsn = rand64();
diff --git a/ctdb/tests/src/protocol_common.h b/ctdb/tests/src/protocol_common.h
index 2b4fb6a07a9..171b19b88c3 100644
--- a/ctdb/tests/src/protocol_common.h
+++ b/ctdb/tests/src/protocol_common.h
@@ -68,6 +68,10 @@ void fill_ctdb_db_vacuum(TALLOC_CTX *mem_ctx, struct ctdb_db_vacuum *p);
void verify_ctdb_db_vacuum(struct ctdb_db_vacuum *p1,
struct ctdb_db_vacuum *p2);
+void fill_ctdb_echo_data(TALLOC_CTX *mem_ctx, struct ctdb_echo_data *p);
+void verify_ctdb_echo_data(struct ctdb_echo_data *p1,
+ struct ctdb_echo_data *p2);
+
void fill_ctdb_ltdb_header(struct ctdb_ltdb_header *p);
void verify_ctdb_ltdb_header(struct ctdb_ltdb_header *p1,
struct ctdb_ltdb_header *p2);
diff --git a/ctdb/tests/src/protocol_common_ctdb.c b/ctdb/tests/src/protocol_common_ctdb.c
index 6989010cd6f..f1d662f0e1d 100644
--- a/ctdb/tests/src/protocol_common_ctdb.c
+++ b/ctdb/tests/src/protocol_common_ctdb.c
@@ -600,6 +600,12 @@ void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx,
assert(cd->data.db_vacuum != NULL);
fill_ctdb_db_vacuum(mem_ctx, cd->data.db_vacuum);
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ cd->data.echo_data = talloc(mem_ctx, struct ctdb_echo_data);
+ assert(cd->data.echo_data != NULL);
+ fill_ctdb_echo_data(mem_ctx, cd->data.echo_data);
+ break;
}
}
@@ -994,6 +1000,10 @@ void verify_ctdb_req_control_data(struct ctdb_req_control_data *cd,
case CTDB_CONTROL_DB_VACUUM:
verify_ctdb_db_vacuum(cd->data.db_vacuum, cd2->data.db_vacuum);
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data);
+ break;
}
}
@@ -1393,6 +1403,12 @@ void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx,
case CTDB_CONTROL_DB_VACUUM:
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ cd->data.echo_data = talloc(mem_ctx, struct ctdb_echo_data);
+ assert(cd->data.echo_data != NULL);
+ fill_ctdb_echo_data(mem_ctx, cd->data.echo_data);
+ break;
}
}
@@ -1733,6 +1749,10 @@ void verify_ctdb_reply_control_data(struct ctdb_reply_control_data *cd,
case CTDB_CONTROL_DB_VACUUM:
break;
+
+ case CTDB_CONTROL_ECHO_DATA:
+ verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data);
+ break;
}
}
diff --git a/ctdb/tests/src/protocol_ctdb_test.c b/ctdb/tests/src/protocol_ctdb_test.c
--
Samba Shared Repository
More information about the samba-cvs
mailing list