Stop spamming the logs with "Could not remove pid XX from serverid.tdb" messages...
authorJeremy Allison <jra@samba.org>
Fri, 1 Jun 2012 19:02:04 +0000 (12:02 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Jun 2012 17:41:54 +0000 (19:41 +0200)
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

index 8cda180f690d8ce9f3244b326bc8de05ff648e5f..9a8cdc0b60e47260a609b4cde38f82ec52cb2156 100644 (file)
@@ -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));
 }
 
 /****************************************************************************