[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
Volker.Lendecke at SerNet.DE
Thu Sep 21 18:16:31 UTC 2017
On Thu, Sep 21, 2017 at 12:57:04PM +0200, Martin Schwenke wrote:
> The branch, master has been updated
> via 503bc39 ctdb-tests: Add tests for PID with srvid
> via 7d034fe ctdb-tests: Implement control CHECK_PID_SRVID in fake daemon
> via c480cc0 ctdb-tests: Reimplement message handlers using srvid abstraction
> via 1c472df ctdb-tool: Update process-exists command to pass optional srvid
> via c6a3520 ctdb-client: Add client code for control CHECK_PID_SRVID
> via 02ae3d9 ctdb-daemon: Add implementation of control CHECK_PID_SRVID
Thanks for this! Unfortunately it does not cover all cases that Samba
needs right now. The attached patch fixes the issue for me, but I'm
sure you have a much better implementation :-)
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 2108ccf7b4562c2865200bd7d0285d7eeb721adc Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 21 Sep 2017 09:24:49 -0700
Subject: [PATCH] ctdb-daemon: CONTROL_CHECK_PID_SRVID should walk all client
conns
Unfortunately Samba has the tendency to open multiple connections to
ctdb from one process. This needs fixing, but we're not there yet. In
the meantime, CTDB_CONTROL_CHECK_PID_SRVID should look at all
connections from a PID to see whether the serverid asked for is
registered.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/server/ctdb_daemon.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index 90e8b715bae..c20408d8831 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1774,7 +1774,7 @@ int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid)
int32_t ctdb_control_check_pid_srvid(struct ctdb_context *ctdb,
TDB_DATA indata)
{
- struct ctdb_client *client;
+ struct ctdb_client_pid_list *client_pid;
pid_t pid;
uint64_t srvid;
int ret;
@@ -1782,17 +1782,18 @@ int32_t ctdb_control_check_pid_srvid(struct ctdb_context *ctdb,
pid = *(pid_t *)indata.dptr;
srvid = *(uint64_t *)(indata.dptr + sizeof(pid_t));
- client = ctdb_find_client_by_pid(ctdb, pid);
- if (client == NULL) {
- return -1;
- }
-
- ret = srvid_exists(ctdb->srv, srvid, client);
- if (ret != 0) {
- return -1;
+ for (client_pid = ctdb->client_pids; client_pid != NULL;
+ client_pid = client_pid->next) {
+ if (client_pid->pid == pid) {
+ ret = srvid_exists(ctdb->srv, srvid,
+ client_pid->client);
+ if (ret == 0) {
+ return 0;
+ }
+ }
}
- return 0;
+ return -1;
}
int ctdb_control_getnodesfile(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
--
2.11.0
More information about the samba-technical
mailing list