From 777ac04a99467594805a03635b04011c495ff7e7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 1 Jun 2012 12:02:04 -0700 Subject: [PATCH] Stop spamming the logs with "Could not remove pid XX from serverid.tdb" messages and initiating the cleanup function on every process deat We now have many sub-processes from smbd that don't serve SMB1/SMB2 requests and don't register themselves in the serverid.tdb. Only initiate the cleanup from processes that were explicitly in the child list. --- source3/smbd/server.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 8cda180f690..9a8cdc0b60e 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -283,6 +283,25 @@ static void remove_child_pid(pid_t pid, bool unclean_shutdown) static struct timed_event *cleanup_te; struct server_id child_id; + child_id = procid_self(); /* Just initialize pid and potentially vnn */ + child_id.pid = pid; + + for (child = children; child != NULL; child = child->next) { + if (child->pid == pid) { + struct child_pid *tmp = child; + DLIST_REMOVE(children, child); + SAFE_FREE(tmp); + num_children -= 1; + break; + } + } + + if (child == NULL) { + /* not all forked child processes are added to the children list */ + DEBUG(2, ("Could not find child %d -- ignoring\n", (int)pid)); + return; + } + if (unclean_shutdown) { /* a child terminated uncleanly so tickle all processes to see if they can grab any of the @@ -301,26 +320,10 @@ static void remove_child_pid(pid_t pid, bool unclean_shutdown) } } - child_id = procid_self(); /* Just initialize pid and potentially vnn */ - child_id.pid = pid; - if (!serverid_deregister(child_id)) { DEBUG(1, ("Could not remove pid %d from serverid.tdb\n", (int)pid)); } - - for (child = children; child != NULL; child = child->next) { - if (child->pid == pid) { - struct child_pid *tmp = child; - DLIST_REMOVE(children, child); - SAFE_FREE(tmp); - num_children -= 1; - return; - } - } - - /* not all forked child processes are added to the children list */ - DEBUG(1, ("Could not find child %d -- ignoring\n", (int)pid)); } /**************************************************************************** -- 2.34.1