1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

smbd: Move serverid_deregister() to the cleanupd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2015-11-06 17:01:02 +01:00
parent 99833c9428
commit 14fc9018aa
2 changed files with 16 additions and 8 deletions

View File

@ -555,12 +555,9 @@ static void remove_child_pid(struct smbd_parent_context *parent,
bool unclean_shutdown)
{
struct smbd_child_pid *child;
struct server_id child_id;
struct iovec iov[2];
NTSTATUS status;
child_id = pid_to_procid(pid);
iov[0] = (struct iovec) { .iov_base = (uint8_t *)&pid,
.iov_len = sizeof(pid) };
iov[1] = (struct iovec) { .iov_base = (uint8_t *)&unclean_shutdown,
@ -605,11 +602,6 @@ static void remove_child_pid(struct smbd_parent_context *parent,
DEBUG(1,("Scheduled cleanup of brl and lock database after unclean shutdown\n"));
}
}
if (!serverid_deregister(child_id)) {
DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
(int)pid));
}
}
/****************************************************************************

View File

@ -19,9 +19,11 @@
#include "replace.h"
#include "smbd_cleanupd.h"
#include "lib/util_procid.h"
#include "lib/util/tevent_ntstatus.h"
#include "lib/util/debug.h"
#include "smbprofile.h"
#include "serverid.h"
struct smbd_cleanupd_state {
pid_t parent_pid;
@ -86,6 +88,7 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
struct smbd_cleanupd_state *state = tevent_req_data(
req, struct smbd_cleanupd_state);
pid_t pid;
struct server_id child_id;
bool unclean_shutdown;
int ret;
@ -101,6 +104,14 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
DBG_DEBUG("%d exited %sclean\n", (int)pid,
unclean_shutdown ? "un" : "");
/*
* Get child_id before messaging_cleanup which wipes the
* unique_id. Not that it really matters here for functionality (the
* child should have properly cleaned up :-)) though, but it looks
* nicer.
*/
child_id = pid_to_procid(pid);
smbprofile_cleanup(pid, state->parent_pid);
ret = messaging_cleanup(msg, pid);
@ -108,6 +119,11 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
if ((ret != 0) && (ret != ENOENT)) {
DBG_DEBUG("messaging_cleanup returned %s\n", strerror(ret));
}
if (!serverid_deregister(child_id)) {
DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
(int)pid));
}
}
NTSTATUS smbd_cleanupd_recv(struct tevent_req *req)